Spaces:
Runtime error
Runtime error
Upload app.py
Browse files
app.py
CHANGED
|
@@ -19,14 +19,23 @@ def clear_chat_history():
|
|
| 19 |
return None
|
| 20 |
|
| 21 |
# Create Gradio interface
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
# Launch the app
|
| 32 |
if __name__ == "__main__":
|
|
|
|
| 19 |
return None
|
| 20 |
|
| 21 |
# Create Gradio interface
|
| 22 |
+
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
| 23 |
+
gr.Markdown("# وكيل الرد التلقائي بالذكاء الاصطناعي")
|
| 24 |
+
gr.Markdown("محادثة مع وكيل ذكاء اصطناعي باستخدام نموذج Blenderbot المفتوح المصدر")
|
| 25 |
+
|
| 26 |
+
chatbot = gr.Chatbot()
|
| 27 |
+
msg = gr.Textbox(
|
| 28 |
+
show_label=False,
|
| 29 |
+
placeholder="اكتب رسالتك هنا...",
|
| 30 |
+
)
|
| 31 |
+
clear = gr.ClearButton([msg, chatbot])
|
| 32 |
+
|
| 33 |
+
def respond(message, chat_history):
|
| 34 |
+
bot_message = responder.generate_response(message, "user123")
|
| 35 |
+
chat_history.append((message, bot_message))
|
| 36 |
+
return "", chat_history
|
| 37 |
+
|
| 38 |
+
msg.submit(respond, [msg, chatbot], [msg, chatbot])
|
| 39 |
|
| 40 |
# Launch the app
|
| 41 |
if __name__ == "__main__":
|