Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,8 +1,8 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import requests
|
| 3 |
|
| 4 |
-
# ضع هنا رابط ngrok الذي
|
| 5 |
-
API_URL = "https://c9147e329066.ngrok-free.app"
|
| 6 |
|
| 7 |
def ask_model(user_input):
|
| 8 |
try:
|
|
@@ -18,19 +18,15 @@ with gr.Blocks() as demo:
|
|
| 18 |
gr.Markdown("# 🤖 Alnabil AI Chatbot")
|
| 19 |
gr.Markdown("تحدث مع موديل النبيل مباشرة عبر Google Colab API")
|
| 20 |
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
chatbot = gr.Chatbot()
|
| 24 |
-
msg = gr.Textbox(placeholder="اكتب رسالتك هنا...")
|
| 25 |
-
with gr.Column(scale=1):
|
| 26 |
-
send_btn = gr.Button("إرسال")
|
| 27 |
|
| 28 |
def respond(message, chat_history):
|
| 29 |
bot_reply = ask_model(message)
|
| 30 |
chat_history.append((message, bot_reply))
|
| 31 |
return "", chat_history
|
| 32 |
|
| 33 |
-
send_btn.click(respond, [msg, chatbot], [msg, chatbot])
|
| 34 |
msg.submit(respond, [msg, chatbot], [msg, chatbot])
|
| 35 |
|
| 36 |
demo.launch()
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import requests
|
| 3 |
|
| 4 |
+
# ضع هنا رابط ngrok الذي ظهر في Google Colab
|
| 5 |
+
API_URL = "https://c9147e329066.ngrok-free.app/chat"
|
| 6 |
|
| 7 |
def ask_model(user_input):
|
| 8 |
try:
|
|
|
|
| 18 |
gr.Markdown("# 🤖 Alnabil AI Chatbot")
|
| 19 |
gr.Markdown("تحدث مع موديل النبيل مباشرة عبر Google Colab API")
|
| 20 |
|
| 21 |
+
chatbot = gr.Chatbot()
|
| 22 |
+
msg = gr.Textbox(placeholder="اكتب رسالتك هنا...")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
def respond(message, chat_history):
|
| 25 |
bot_reply = ask_model(message)
|
| 26 |
chat_history.append((message, bot_reply))
|
| 27 |
return "", chat_history
|
| 28 |
|
|
|
|
| 29 |
msg.submit(respond, [msg, chatbot], [msg, chatbot])
|
| 30 |
|
| 31 |
demo.launch()
|
| 32 |
+
|