Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import openai
|
2 |
+
import gradio as gr
|
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 greet(name):
|
9 |
+
return "Hello !!"
|
10 |
+
|
11 |
+
|
12 |
+
|
13 |
+
def CustomChatGPT(user_input):
|
14 |
+
messages.append({"role": "user", "content": enter_input_here})
|
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=greet, inputs="text", outputs="text", title = "Real Estate Pro")
|
24 |
+
|
25 |
+
iface.launch(share=True)
|