Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -209,29 +209,28 @@ with gr.Blocks(css=custom_css) as demo:
|
|
209 |
pdf_input = gr.File(label="اختر ملف PDF للدردشة")
|
210 |
process_button = gr.Button("رفع وبدء الدردشة")
|
211 |
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
)
|
224 |
-
|
225 |
-
audio_output = gr.Audio(label="الرد الصوتي")
|
226 |
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
|
|
|
|
235 |
|
236 |
demo.launch()
|
237 |
|
|
|
209 |
pdf_input = gr.File(label="اختر ملف PDF للدردشة")
|
210 |
process_button = gr.Button("رفع وبدء الدردشة")
|
211 |
|
212 |
+
chat_interface = gr.ChatInterface(
|
213 |
+
chat,
|
214 |
+
title="الدردشة مع البوت",
|
215 |
+
description="اسأل أي سؤال عن محتوى الملف PDF",
|
216 |
+
theme="soft",
|
217 |
+
examples=["ما هو موضوع الوثيقة؟", "من هم الأشخاص المذكورون؟", "ما هي التواريخ الرئيسية المذكورة؟"],
|
218 |
+
cache_examples=True,
|
219 |
+
retry_btn=None,
|
220 |
+
undo_btn="مسح آخر رسالة",
|
221 |
+
clear_btn="مسح المحادثة",
|
222 |
+
)
|
|
|
|
|
|
|
223 |
|
224 |
+
audio_output = gr.Audio(label="الرد الصوتي")
|
225 |
+
|
226 |
+
process_button.click(process_pdf, inputs=[pdf_input], outputs=[chat_interface.textbox])
|
227 |
+
|
228 |
+
# Use the internal Textbox and Chatbot provided by the ChatInterface
|
229 |
+
chat_interface.submit(
|
230 |
+
fn=lambda x, y: y[-1][1],
|
231 |
+
inputs=[chat_interface.textbox, chat_interface.chatbot],
|
232 |
+
outputs=[audio_output]
|
233 |
+
)
|
234 |
|
235 |
demo.launch()
|
236 |
|