File size: 2,011 Bytes
78240ec |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
import streamlit as st
from dotenv import load_dotenv
from openai import OpenAI
load_dotenv()
client = OpenAI()
def trial():
user_input = input("enter Prompt")
done_thinking,response =thinnk(user_input)
if done_thinking:
print(response)
else: print("someothing went wrong")
def thinnk(user_):
response = client.chat.completions.create(
model="ft:gpt-3.5-turbo-1106:group-c::8YTKwLjB",
messages=[
{"role": "system", "content": "You are a school guidance counsellor on the lookout for chats that hint of cyberbullying in a WhatsApp group chat."},
{"role": "user", "content": user_}
]
)
ai_response = response.choices[0].message.content
return True , ai_response
clientId = 'YexToZlUgbRsHRjbzy8yckhAoegwQEcX'
domainName = 'dev-r7cupi8h76qk3w31.us.auth0.com'
text_for_tab_1 ="""
Select a value to help your bot know
how fast you read, speed increases from 1
for very slow readers up to 5 for very fast reader"""
text_for_tab_2 ="""Opt for 1 if you typically require additional time when learning
new things, or select 5 if acquiring new knowledge comes effortlessly
to you.
"""
text_for_tab_3 ="""
Please indicate a value that
reflects your current proficiency in English
for your bot's understanding.
Choose 1 if your vocabulary is fundamental,
or select 5 if you appreciate
using extensive and sophisticated language."""
def run_once():
if "user_info" not in st.session_state:
st.session_state.user_info = False
if "signed_in" not in st.session_state:
st.session_state.signed_in = False
if "t2" and "t1" and "t3" not in st.session_state:
st.session_state.t1 = False
st.session_state.t2 = False
st.session_state.t3 = False
if "Prompt" not in st.session_state:
st.session_state.Prompt = False
if "messages" not in st.session_state:
st.session_state.messages = []
|