Nexchan commited on
Commit
6b0e09f
·
verified ·
1 Parent(s): ed4f022

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -9
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
- 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], icon="https://img.icons8.com/?size=100&id=Xnx8cxDef16O&format=png&color=000000")
67
- send_btn = gr.Button("Send", variant='primary', icon="https://img.icons8.com/?size=100&id=g8ltXTwIfJ1n&format=png&color=000000")
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
 
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], icon="https://img.icons8.com/?size=100&id=Xnx8cxDef16O&format=png&color=000000")
67
+ send_btn = gr.Button("Send", variant='primary', icon="https://img.icons8.com/?size=100&id=g8ltXTwIfJ1n&format=png&color=000000")
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
72
+ demo.load(fn=api_chat, inputs="state", outputs="state")
73
 
74
 
75
  if __name__ == "__main__":