edit style
Browse files
app.py
CHANGED
|
@@ -38,11 +38,23 @@ def respond(chat_history, message):
|
|
| 38 |
return result
|
| 39 |
|
| 40 |
with gr.Blocks() as demo:
|
|
|
|
|
|
|
| 41 |
chatbot = gr.Chatbot()
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
|
| 48 |
demo.launch(server_name="0.0.0.0", server_port=8000)
|
|
|
|
| 38 |
return result
|
| 39 |
|
| 40 |
with gr.Blocks() as demo:
|
| 41 |
+
gr.Markdown("## Chat with GPT")
|
| 42 |
+
state = gr.State()
|
| 43 |
chatbot = gr.Chatbot()
|
| 44 |
+
message = gr.Textbox(label = "Message:", placeholder="Enter text")
|
| 45 |
+
message.submit(
|
| 46 |
+
respond,
|
| 47 |
+
[chatbot, message],
|
| 48 |
+
chatbot,
|
| 49 |
+
)
|
| 50 |
+
with gr.Row():
|
| 51 |
+
clear = gr.Button("Clear")
|
| 52 |
+
clear.click(lambda: None, None, chatbot)
|
| 53 |
+
send = gr.Button("Send")
|
| 54 |
+
send.click(
|
| 55 |
+
respond,
|
| 56 |
+
[chatbot, message],
|
| 57 |
+
chatbot,
|
| 58 |
+
)
|
| 59 |
|
| 60 |
demo.launch(server_name="0.0.0.0", server_port=8000)
|