basit123796 commited on
Commit
1c7d8d6
·
1 Parent(s): 7ec3f6a

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -0
app.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import openai
2
+ import gradio as gr
3
+
4
+
5
+
6
+ openai.api_key = "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"
7
+
8
+ messages = [{"role": "system", "content": "You are a financial experts that specializes in real estate investment and negotiation"}]
9
+
10
+
11
+
12
+
13
+ def CustomChatGPT(user_input):
14
+ messages.append({"role": "user", "content": user_input})
15
+ response = openai.ChatCompletion.create(
16
+ model = "gpt-3.5-turbo",
17
+ messages = messages
18
+ )
19
+ ChatGPT_reply = response["choices"][0]["message"]["content"]
20
+ messages.append({"role": "assistant", "content": ChatGPT_reply})
21
+ return ChatGPT_reply
22
+
23
+ iface = gr.Interface(fn=CustomChatGPT, inputs = "text", outputs = "text", title = "basit cyberwala gpt")
24
+ iface.launch()
25
+