Spaces:
Sleeping
Sleeping
u393845
commited on
Commit
•
c421d36
1
Parent(s):
6922b5d
file
Browse files
app.py
CHANGED
@@ -264,20 +264,19 @@ questions = [
|
|
264 |
|
265 |
recommender = SemanticSearch()
|
266 |
|
|
|
|
|
267 |
title = ''
|
268 |
description = """"""
|
269 |
|
270 |
-
with gr.Blocks(css="""#chatbot { font-size: 14px; min-height:
|
271 |
gr.Markdown(f'<center><h3>{title}</h3></center>')
|
272 |
gr.Markdown(description)
|
273 |
|
274 |
try:
|
275 |
with gr.Row():
|
276 |
with gr.Group():
|
277 |
-
#gr.Markdown(
|
278 |
-
# f'<p style="text-align:center">Get your Open AI API key <a href="https://platform.openai.com/account/api-keys">here</a></p>')
|
279 |
with gr.Accordion(""):
|
280 |
-
#openAI_key = gr.Textbox(label='Enter your OpenAI API key here', password=True)
|
281 |
url = gr.Textbox(label='Enter PDF URL here (Example: https://arxiv.org/pdf/1706.03762.pdf )')
|
282 |
gr.Markdown("<center><h4>OR<h4></center>")
|
283 |
file = gr.File(label='Upload your PDF/ Research Paper / Book here', file_types=['.pdf'])
|
@@ -297,24 +296,19 @@ with gr.Blocks(css="""#chatbot { font-size: 14px; min-height: 1200; }""") as dem
|
|
297 |
'gpt-4-32k'
|
298 |
], label='Select Model', default='gpt-3.5-turbo')
|
299 |
btn = gr.Button(value='Submit')
|
300 |
-
|
301 |
btn.style(full_width=True)
|
302 |
|
303 |
with gr.Group():
|
304 |
chatbot = gr.Chatbot(placeholder="Chat History", label="Chat History", lines=50, elem_id="chatbot")
|
305 |
-
except:
|
306 |
-
print("error in gradio")
|
307 |
-
#
|
308 |
-
# Bind the click event of the button to the question_answer function
|
309 |
|
310 |
-
|
311 |
btn.click(
|
312 |
question_answer,
|
313 |
inputs=[chatbot, url, file, question, model],
|
314 |
outputs=[chatbot],
|
315 |
)
|
316 |
-
except:
|
317 |
-
print("error in btn.click")
|
318 |
|
319 |
-
|
|
|
|
|
320 |
demo.launch()
|
|
|
264 |
|
265 |
recommender = SemanticSearch()
|
266 |
|
267 |
+
import gradio as gr
|
268 |
+
|
269 |
title = ''
|
270 |
description = """"""
|
271 |
|
272 |
+
with gr.Blocks(css="""#chatbot { font-size: 14px; min-height: 1200px; }""") as demo:
|
273 |
gr.Markdown(f'<center><h3>{title}</h3></center>')
|
274 |
gr.Markdown(description)
|
275 |
|
276 |
try:
|
277 |
with gr.Row():
|
278 |
with gr.Group():
|
|
|
|
|
279 |
with gr.Accordion(""):
|
|
|
280 |
url = gr.Textbox(label='Enter PDF URL here (Example: https://arxiv.org/pdf/1706.03762.pdf )')
|
281 |
gr.Markdown("<center><h4>OR<h4></center>")
|
282 |
file = gr.File(label='Upload your PDF/ Research Paper / Book here', file_types=['.pdf'])
|
|
|
296 |
'gpt-4-32k'
|
297 |
], label='Select Model', default='gpt-3.5-turbo')
|
298 |
btn = gr.Button(value='Submit')
|
|
|
299 |
btn.style(full_width=True)
|
300 |
|
301 |
with gr.Group():
|
302 |
chatbot = gr.Chatbot(placeholder="Chat History", label="Chat History", lines=50, elem_id="chatbot")
|
|
|
|
|
|
|
|
|
303 |
|
304 |
+
# Bind the click event of the button to the question_answer function
|
305 |
btn.click(
|
306 |
question_answer,
|
307 |
inputs=[chatbot, url, file, question, model],
|
308 |
outputs=[chatbot],
|
309 |
)
|
|
|
|
|
310 |
|
311 |
+
except Exception as e:
|
312 |
+
print(f"Error: {e}")
|
313 |
+
|
314 |
demo.launch()
|