Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
-
import
|
| 2 |
-
import openai
|
| 3 |
import os
|
|
|
|
| 4 |
|
| 5 |
openai.api_key = os.environ.get("OPENAI_API_KEY")
|
| 6 |
content = os.environ.get("CHAT_TYPE")
|
|
@@ -35,13 +35,7 @@ def chatbot(topic):
|
|
| 35 |
return "\n".join(result)
|
| 36 |
|
| 37 |
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
chat_result = chatbot(topic)
|
| 43 |
-
st.text_area("聊天内容", chat_result)
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
if __name__ == "__main__":
|
| 47 |
-
main()
|
|
|
|
| 1 |
+
import gradio as gr
|
|
|
|
| 2 |
import os
|
| 3 |
+
import openai
|
| 4 |
|
| 5 |
openai.api_key = os.environ.get("OPENAI_API_KEY")
|
| 6 |
content = os.environ.get("CHAT_TYPE")
|
|
|
|
| 35 |
return "\n".join(result)
|
| 36 |
|
| 37 |
|
| 38 |
+
iface = gr.Interface(fn=chatbot, inputs=gr.inputs.Textbox(label="请输入话题"),
|
| 39 |
+
outputs=gr.outputs.Textbox(label="聊天内容"), title="GPT聊天室(人类不得入内)",
|
| 40 |
+
layout="vertical")
|
| 41 |
+
iface.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|