Spaces:
Runtime error
Runtime error
Commit
·
10f1021
1
Parent(s):
da069cb
Update app.py
Browse files
app.py
CHANGED
@@ -4,7 +4,7 @@ import gradio as gr
|
|
4 |
|
5 |
openai.api_key = os.environ['OPENAI_API_KEY']
|
6 |
|
7 |
-
prompt = "
|
8 |
|
9 |
def openai_create(prompt):
|
10 |
response = openai.Completion.create(
|
@@ -49,13 +49,14 @@ def chatgpt_clear(input, history):
|
|
49 |
blocks = gr.Blocks()
|
50 |
|
51 |
with blocks:
|
52 |
-
chatbot = gr.Chatbot()
|
53 |
-
message = gr.Textbox(placeholder=prompt)
|
54 |
state = gr.State()
|
55 |
-
clear = gr.Button("Clear")
|
56 |
-
clear.click(fn=chatgpt_clear, inputs=[message, state], outputs=[message, chatbot, state])
|
57 |
submit = gr.Button("Send")
|
58 |
submit.click(fn=chatgpt_chatclone, inputs=[message, state], outputs=[chatbot, state])
|
|
|
|
|
|
|
59 |
|
60 |
|
61 |
blocks.launch(debug=False)
|
|
|
4 |
|
5 |
openai.api_key = os.environ['OPENAI_API_KEY']
|
6 |
|
7 |
+
prompt = "这个小程序是为华夏基金制作的OpenAI连通性概念验证。"
|
8 |
|
9 |
def openai_create(prompt):
|
10 |
response = openai.Completion.create(
|
|
|
49 |
blocks = gr.Blocks()
|
50 |
|
51 |
with blocks:
|
52 |
+
chatbot = gr.Chatbot(label="OpenAI分析师")
|
53 |
+
message = gr.Textbox(placeholder=prompt, label="你")
|
54 |
state = gr.State()
|
|
|
|
|
55 |
submit = gr.Button("Send")
|
56 |
submit.click(fn=chatgpt_chatclone, inputs=[message, state], outputs=[chatbot, state])
|
57 |
+
clear = gr.Button("Clear")
|
58 |
+
clear.click(fn=chatgpt_clear, inputs=[message, state], outputs=[message, chatbot, state])
|
59 |
+
|
60 |
|
61 |
|
62 |
blocks.launch(debug=False)
|