vaibhavi commited on
Commit
c89f48d
·
1 Parent(s): 630443d

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -0
app.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import openai
2
+ import gradio
3
+ openai.api_key = "GPT_API_KEY"
4
+
5
+ messages = [{"role": "system",
6
+ "content": "You are a student counselor that plays a vital role in helping students navigate the challenges they face during their academic journey"
7
+ }]
8
+
9
+ def Saarathi(Student_Query):
10
+ messages.append({"role": "user", "content": Student_Query})
11
+ response = openai.ChatCompletion.create(
12
+ model = "gpt-3.5-turbo",
13
+ messages = messages
14
+ )
15
+ guidance = response["choices"][0]["message"]["content"]
16
+ messages.append({"role": "assistant", "content": guidance})
17
+ return guidance
18
+
19
+ SaarathiGUI = gradio.Interface(fn=Saarathi,
20
+ inputs = gradio.Textbox(label="Student"),
21
+ outputs = gradio.Textbox(label="Counselor"),
22
+ title = "Saarathi:Get guidance at your fingertips with our student counselor chatbot")
23
+
24
+ SaarathiGUI.launch(share=True)