Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -58,15 +58,18 @@ def api_chat(chat_history: List[Dict[str, str]]):
|
|
| 58 |
|
| 59 |
# Mengatur antarmuka Gradio
|
| 60 |
with gr.Blocks() as demo:
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
|
|
|
|
|
|
|
|
|
| 70 |
|
| 71 |
|
| 72 |
if __name__ == "__main__":
|
|
|
|
| 58 |
|
| 59 |
# Mengatur antarmuka Gradio
|
| 60 |
with gr.Blocks() as demo:
|
| 61 |
+
with gr.Row():
|
| 62 |
+
with gr.Column():
|
| 63 |
+
chatbot = gr.Chatbot()
|
| 64 |
+
msg = gr.Textbox(interactive=True)
|
| 65 |
+
with gr.Row():
|
| 66 |
+
clear = gr.ClearButton([msg, chatbot])
|
| 67 |
+
send_btn = gr.Button("Send", variant='primary')
|
| 68 |
+
msg.submit(fn=chat_mem, inputs=[msg, chatbot], outputs=[msg, chatbot])
|
| 69 |
+
send_btn.click(fn=chat_mem, inputs=[msg, chatbot], outputs=[msg, chatbot])
|
| 70 |
+
|
| 71 |
+
# Menambahkan endpoint API untuk api_chat
|
| 72 |
+
demo.add_api_route("/api/chat", api_chat, methods=["POST"])
|
| 73 |
|
| 74 |
|
| 75 |
if __name__ == "__main__":
|