ZeroTech commited on
Commit
32fb1b2
·
1 Parent(s): 4d69ac7

Update app.py

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