Spaces:
Runtime error
Runtime error
app.py
Browse files
app.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from g4f.client import Client
|
2 |
+
import gradio
|
3 |
+
|
4 |
+
messages = [{"role": "system", "content": "You are a financial experts that specializes in real estate investment and negotiation"}]
|
5 |
+
|
6 |
+
def CustomChatGPT(user_input):
|
7 |
+
client = Client()
|
8 |
+
messages.append({"role": "user", "content": user_input})
|
9 |
+
response = client.chat.completions.create(
|
10 |
+
model="gpt-4-turbo",
|
11 |
+
messages=messages)
|
12 |
+
ChatGPT_reply = response.choices[0].message.content
|
13 |
+
messages.append({"role": "assistant", "content": ChatGPT_reply})
|
14 |
+
return ChatGPT_reply
|
15 |
+
|
16 |
+
demo = gradio.Interface(fn=CustomChatGPT, inputs = "text", outputs = "text", title = "Real Estate Pro")
|
17 |
+
|
18 |
+
demo.launch(share=True)
|