Spaces:
Sleeping
Sleeping
u393845
commited on
Commit
•
aa06c50
1
Parent(s):
3c71ce9
files
Browse files
app.py
CHANGED
@@ -148,7 +148,8 @@ def generate_answer(question, openAI_key, model):
|
|
148 |
return answer
|
149 |
|
150 |
|
151 |
-
def question_answer(chat_history, url, file, question,
|
|
|
152 |
try:
|
153 |
if openAI_key.strip()=='':
|
154 |
return '[ERROR]: Please enter your Open AI Key. Get your key here : https://platform.openai.com/account/api-keys'
|
@@ -248,9 +249,9 @@ with gr.Blocks(css="""#chatbot { font-size: 14px; min-height: 1200; }""") as dem
|
|
248 |
with gr.Row():
|
249 |
|
250 |
with gr.Group():
|
251 |
-
gr.Markdown(f'<p style="text-align:center">Get your Open AI API key <a href="https://platform.openai.com/account/api-keys">here</a></p>')
|
252 |
-
with gr.Accordion("
|
253 |
-
openAI_key = gr.Textbox(label='Enter your OpenAI API key here', password=True)
|
254 |
url = gr.Textbox(label='Enter PDF URL here (Example: https://arxiv.org/pdf/1706.03762.pdf )')
|
255 |
gr.Markdown("<center><h4>OR<h4></center>")
|
256 |
file = gr.File(label='Upload your PDF/ Research Paper / Book here', file_types=['.pdf'])
|
@@ -281,7 +282,7 @@ with gr.Blocks(css="""#chatbot { font-size: 14px; min-height: 1200; }""") as dem
|
|
281 |
# Bind the click event of the button to the question_answer function
|
282 |
btn.click(
|
283 |
question_answer,
|
284 |
-
inputs=[chatbot, url, file, question,
|
285 |
outputs=[chatbot],
|
286 |
)
|
287 |
|
|
|
148 |
return answer
|
149 |
|
150 |
|
151 |
+
def question_answer(chat_history, url, file, question, model):
|
152 |
+
openAI_key = 'abcd'
|
153 |
try:
|
154 |
if openAI_key.strip()=='':
|
155 |
return '[ERROR]: Please enter your Open AI Key. Get your key here : https://platform.openai.com/account/api-keys'
|
|
|
249 |
with gr.Row():
|
250 |
|
251 |
with gr.Group():
|
252 |
+
#gr.Markdown(f'<p style="text-align:center">Get your Open AI API key <a href="https://platform.openai.com/account/api-keys">here</a></p>')
|
253 |
+
with gr.Accordion(""):
|
254 |
+
# openAI_key = gr.Textbox(label='Enter your OpenAI API key here', password=True)
|
255 |
url = gr.Textbox(label='Enter PDF URL here (Example: https://arxiv.org/pdf/1706.03762.pdf )')
|
256 |
gr.Markdown("<center><h4>OR<h4></center>")
|
257 |
file = gr.File(label='Upload your PDF/ Research Paper / Book here', file_types=['.pdf'])
|
|
|
282 |
# Bind the click event of the button to the question_answer function
|
283 |
btn.click(
|
284 |
question_answer,
|
285 |
+
inputs=[chatbot, url, file, question, model],
|
286 |
outputs=[chatbot],
|
287 |
)
|
288 |
|