Spaces:
Sleeping
Sleeping
MohammedNasser
commited on
Commit
•
30b68de
1
Parent(s):
39c89fc
Update app.py
Browse files
app.py
CHANGED
@@ -175,18 +175,16 @@ p {
|
|
175 |
"""
|
176 |
# Gradio interface
|
177 |
with gr.Blocks(css=custom_css) as demo:
|
178 |
-
gr.Markdown("#
|
179 |
gr.Markdown("## المنعقد السبت 14 - سبتمبر 2024")
|
180 |
|
181 |
with gr.Row():
|
182 |
pdf_input = gr.File(label="اختر ملف PDF للدردشة")
|
183 |
process_button = gr.Button("رفع وبدء الدردشة")
|
184 |
|
185 |
-
#
|
186 |
chat_interface = gr.ChatInterface(
|
187 |
chat,
|
188 |
-
# Removed: chatbot=gr.Chatbot(height=400),
|
189 |
-
textbox=gr.Textbox(placeholder="اكتب سؤالك هنا...", container=False),
|
190 |
title="الدردشة مع البوت",
|
191 |
description="اسأل أي سؤال عن محتوى الملف PDF",
|
192 |
theme="soft",
|
@@ -197,17 +195,17 @@ with gr.Blocks(css=custom_css) as demo:
|
|
197 |
clear_btn="مسح المحادثة",
|
198 |
)
|
199 |
|
200 |
-
# Remove the separate chatbot instance here
|
201 |
audio_output = gr.Audio(label="الرد الصوتي")
|
202 |
|
203 |
process_button.click(process_pdf, inputs=[pdf_input], outputs=[chat_interface.textbox])
|
204 |
|
205 |
-
#
|
206 |
chat_interface.submit(
|
207 |
fn=lambda x, y: y[-1][1],
|
208 |
-
inputs=[chat_interface.textbox, chat_interface.chatbot],
|
209 |
outputs=[audio_output]
|
210 |
)
|
211 |
|
212 |
demo.launch()
|
213 |
|
|
|
|
175 |
"""
|
176 |
# Gradio interface
|
177 |
with gr.Blocks(css=custom_css) as demo:
|
178 |
+
gr.Markdown("# ديمو بوت للقاء مركز حضرموت للدراسات التاريخية")
|
179 |
gr.Markdown("## المنعقد السبت 14 - سبتمبر 2024")
|
180 |
|
181 |
with gr.Row():
|
182 |
pdf_input = gr.File(label="اختر ملف PDF للدردشة")
|
183 |
process_button = gr.Button("رفع وبدء الدردشة")
|
184 |
|
185 |
+
# Let Gradio manage the Textbox internally within ChatInterface
|
186 |
chat_interface = gr.ChatInterface(
|
187 |
chat,
|
|
|
|
|
188 |
title="الدردشة مع البوت",
|
189 |
description="اسأل أي سؤال عن محتوى الملف PDF",
|
190 |
theme="soft",
|
|
|
195 |
clear_btn="مسح المحادثة",
|
196 |
)
|
197 |
|
|
|
198 |
audio_output = gr.Audio(label="الرد الصوتي")
|
199 |
|
200 |
process_button.click(process_pdf, inputs=[pdf_input], outputs=[chat_interface.textbox])
|
201 |
|
202 |
+
# Use the internal Textbox and Chatbot provided by the ChatInterface
|
203 |
chat_interface.submit(
|
204 |
fn=lambda x, y: y[-1][1],
|
205 |
+
inputs=[chat_interface.textbox, chat_interface.chatbot],
|
206 |
outputs=[audio_output]
|
207 |
)
|
208 |
|
209 |
demo.launch()
|
210 |
|
211 |
+
|