Spaces:
Sleeping
Sleeping
MohammedNasser
commited on
Commit
•
c1f9d40
1
Parent(s):
71e197c
Update app.py
Browse files
app.py
CHANGED
@@ -163,6 +163,7 @@ def upload_pdf(pdf_file):
|
|
163 |
data = load_pdf(pdf_file)
|
164 |
vectorstore = prepare_vectorstore(data)
|
165 |
chain = create_chain(vectorstore)
|
|
|
166 |
|
167 |
|
168 |
def chat(user_input):
|
@@ -197,6 +198,8 @@ def chat(user_input):
|
|
197 |
with gr.Blocks(css=custom_css) as demo:
|
198 |
|
199 |
pdf_input = gr.File(label="اختر ملف PDF")
|
|
|
|
|
200 |
|
201 |
submit_button_pdf = gr.Button("ارفع الملف")
|
202 |
|
@@ -210,14 +213,14 @@ with gr.Blocks(css=custom_css) as demo:
|
|
210 |
|
211 |
|
212 |
# Connect upload button to upload function
|
213 |
-
submit_button_pdf.click(upload_pdf, inputs=[pdf_input])
|
214 |
|
215 |
|
216 |
# Connect chat button to chat function
|
217 |
submit_button_chat.click(chat, inputs=[chat_input], outputs=[chat_output, audio_output])
|
218 |
|
219 |
# Launch the Gradio app
|
220 |
-
demo.launch()
|
221 |
|
222 |
|
223 |
|
|
|
163 |
data = load_pdf(pdf_file)
|
164 |
vectorstore = prepare_vectorstore(data)
|
165 |
chain = create_chain(vectorstore)
|
166 |
+
return "تم تحميل الملف بنجاح !"
|
167 |
|
168 |
|
169 |
def chat(user_input):
|
|
|
198 |
with gr.Blocks(css=custom_css) as demo:
|
199 |
|
200 |
pdf_input = gr.File(label="اختر ملف PDF")
|
201 |
+
|
202 |
+
output_text = gr.Textbox(label=" ")
|
203 |
|
204 |
submit_button_pdf = gr.Button("ارفع الملف")
|
205 |
|
|
|
213 |
|
214 |
|
215 |
# Connect upload button to upload function
|
216 |
+
submit_button_pdf.click(upload_pdf, inputs=[pdf_input], outputs=[output_text])
|
217 |
|
218 |
|
219 |
# Connect chat button to chat function
|
220 |
submit_button_chat.click(chat, inputs=[chat_input], outputs=[chat_output, audio_output])
|
221 |
|
222 |
# Launch the Gradio app
|
223 |
+
demo.launch(inbrowser=True)
|
224 |
|
225 |
|
226 |
|