Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -140,8 +140,7 @@ def question_answer(url, file, question, openAI_key):
|
|
140 |
return '[ERROR]: Both URL and PDF are provided. Please provide only one (either URL or PDF).'
|
141 |
|
142 |
if url.strip() != '':
|
143 |
-
|
144 |
-
download_pdf(glob_url, 'corpus.pdf')
|
145 |
load_recommender('corpus.pdf')
|
146 |
|
147 |
else:
|
@@ -157,13 +156,11 @@ def question_answer(url, file, question, openAI_key):
|
|
157 |
return generate_answer(question, openAI_key)
|
158 |
|
159 |
|
160 |
-
recommender = SemanticSearch()
|
161 |
-
|
162 |
title = 'PDF GPT'
|
163 |
description = """ PDF GPT allows you to chat with your PDF file using Universal Sentence Encoder and Open AI. It gives hallucination free response than other tools as the embeddings are better than OpenAI. The returned response can even cite the page number in square brackets([]) where the information is located, adding credibility to the responses and helping to locate pertinent information quickly."""
|
164 |
|
165 |
-
|
|
|
166 |
|
167 |
-
iface.launch()
|
168 |
|
169 |
|
|
|
140 |
return '[ERROR]: Both URL and PDF are provided. Please provide only one (either URL or PDF).'
|
141 |
|
142 |
if url.strip() != '':
|
143 |
+
download_pdf(url, 'corpus.pdf')
|
|
|
144 |
load_recommender('corpus.pdf')
|
145 |
|
146 |
else:
|
|
|
156 |
return generate_answer(question, openAI_key)
|
157 |
|
158 |
|
|
|
|
|
159 |
title = 'PDF GPT'
|
160 |
description = """ PDF GPT allows you to chat with your PDF file using Universal Sentence Encoder and Open AI. It gives hallucination free response than other tools as the embeddings are better than OpenAI. The returned response can even cite the page number in square brackets([]) where the information is located, adding credibility to the responses and helping to locate pertinent information quickly."""
|
161 |
|
162 |
+
iface = gr.Interface(fn=question_answer, inputs=[gr.inputs.Textbox(label="Enter PDF URL here"), file, question, openAI_key], outputs=[answer], title=title, description=description)
|
163 |
+
iface.launch()
|
164 |
|
|
|
165 |
|
166 |
|