MohammedNasser commited on
Commit
03ed832
·
verified ·
1 Parent(s): d800d23

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -22
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
- # Let Gradio manage the Textbox internally within ChatInterface
213
- chat_interface = gr.ChatInterface(
214
- chat,
215
- title="الدردشة مع البوت",
216
- description="اسأل أي سؤال عن محتوى الملف PDF",
217
- theme="soft",
218
- examples=["ما هو موضوع الوثيقة؟", "من هم الأشخاص المذكورون؟", "ما هي التواريخ الرئيسية المذكورة؟"],
219
- cache_examples=True,
220
- retry_btn=None,
221
- undo_btn="مسح آخر رسالة",
222
- clear_btn="مسح المحادثة",
223
- )
224
-
225
- audio_output = gr.Audio(label="الرد الصوتي")
226
 
227
- process_button.click(process_pdf, inputs=[pdf_input], outputs=[chat_interface.textbox])
228
-
229
- # Use the internal Textbox and Chatbot provided by the ChatInterface
230
- chat_interface.submit(
231
- fn=lambda x, y: y[-1][1],
232
- inputs=[chat_interface.textbox, chat_interface.chatbot],
233
- outputs=[audio_output]
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