Spaces:
Runtime error
Runtime error
Commit
·
5ebac65
1
Parent(s):
2dcecb0
Update 03 chatgpt chat assistant website.py
Browse files
03 chatgpt chat assistant website.py
CHANGED
|
@@ -1,10 +1,15 @@
|
|
| 1 |
import openai
|
| 2 |
-
import gradio
|
|
|
|
|
|
|
| 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(
|
|
@@ -15,6 +20,6 @@ def CustomChatGPT(user_input):
|
|
| 15 |
messages.append({"role": "assistant", "content": ChatGPT_reply})
|
| 16 |
return ChatGPT_reply
|
| 17 |
|
| 18 |
-
|
|
|
|
| 19 |
|
| 20 |
-
demo.launch(share=True)
|
|
|
|
| 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(
|
|
|
|
| 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 |
|
|
|