Update app.py
Browse files
app.py
CHANGED
|
@@ -13,10 +13,8 @@ history = []
|
|
| 13 |
|
| 14 |
def chat_with_model(message, files=None):
|
| 15 |
global history
|
| 16 |
-
|
| 17 |
content = message
|
| 18 |
|
| 19 |
-
# قراءة محتوى الملفات المرفوعة
|
| 20 |
if files:
|
| 21 |
for file in files:
|
| 22 |
try:
|
|
@@ -46,15 +44,16 @@ def chat_with_model(message, files=None):
|
|
| 46 |
|
| 47 |
return response_text, history
|
| 48 |
|
| 49 |
-
# واجهة Gradio
|
| 50 |
with gr.Blocks() as demo:
|
| 51 |
gr.Markdown("# NVIDIA Qwen3 Chat (متعدد الملفات)")
|
| 52 |
-
chatbot = gr.Chatbot(type="messages")
|
| 53 |
|
| 54 |
msg = gr.Textbox(label="اكتب رسالتك هنا")
|
|
|
|
| 55 |
files_input = gr.File(label="ارفع ملفات Python أو نصية",
|
| 56 |
file_types=[".py", ".txt"],
|
| 57 |
-
|
|
|
|
| 58 |
send = gr.Button("إرسال")
|
| 59 |
|
| 60 |
def handle_submit(message, files):
|
|
|
|
| 13 |
|
| 14 |
def chat_with_model(message, files=None):
|
| 15 |
global history
|
|
|
|
| 16 |
content = message
|
| 17 |
|
|
|
|
| 18 |
if files:
|
| 19 |
for file in files:
|
| 20 |
try:
|
|
|
|
| 44 |
|
| 45 |
return response_text, history
|
| 46 |
|
|
|
|
| 47 |
with gr.Blocks() as demo:
|
| 48 |
gr.Markdown("# NVIDIA Qwen3 Chat (متعدد الملفات)")
|
| 49 |
+
chatbot = gr.Chatbot(type="messages")
|
| 50 |
|
| 51 |
msg = gr.Textbox(label="اكتب رسالتك هنا")
|
| 52 |
+
# الاستخدام الصحيح لقبول ملفات متعددة
|
| 53 |
files_input = gr.File(label="ارفع ملفات Python أو نصية",
|
| 54 |
file_types=[".py", ".txt"],
|
| 55 |
+
file_types=None,
|
| 56 |
+
file_types_allow_multiple=True) # هذه تعمل غالباً على النسخ القديمة
|
| 57 |
send = gr.Button("إرسال")
|
| 58 |
|
| 59 |
def handle_submit(message, files):
|