Spaces:
Sleeping
Sleeping
Commit
·
cdf31a9
1
Parent(s):
9093489
Update app.py
Browse files
app.py
CHANGED
@@ -153,8 +153,29 @@ recommender = SemanticSearch()
|
|
153 |
title = 'PDF GPT'
|
154 |
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."""
|
155 |
|
156 |
-
|
157 |
-
inputs=["textbox", "file", "textbox", "textbox"],
|
158 |
-
outputs="textbox")
|
159 |
|
160 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
153 |
title = 'PDF GPT'
|
154 |
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."""
|
155 |
|
156 |
+
with gr.Blocks() as demo:
|
|
|
|
|
157 |
|
158 |
+
gr.Markdown(f'<center><h1>{title}</h1></center>')
|
159 |
+
gr.Markdown(description)
|
160 |
+
|
161 |
+
with gr.Row():
|
162 |
+
|
163 |
+
with gr.Group():
|
164 |
+
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>')
|
165 |
+
url = gr.Textbox(label='Enter PDF URL here')
|
166 |
+
gr.Markdown("<center><h4>OR<h4></center>")
|
167 |
+
file = gr.File(label='Upload your PDF/ Research Paper / Book here', file_types=['.pdf'])
|
168 |
+
question = gr.Textbox(label='Enter your question here')
|
169 |
+
btn = gr.Button(value='Submit')
|
170 |
+
btn.style(full_width=True)
|
171 |
+
|
172 |
+
with gr.Group():
|
173 |
+
answer = gr.Textbox(label='The answer to your question is :')
|
174 |
+
|
175 |
+
btn.click(question_answer, inputs=[url, file, question,openAI_key], outputs=[answer])
|
176 |
+
|
177 |
+
with gr.Sidebar():
|
178 |
+
openAI_key=gr.Textbox(label='Enter your OpenAI API key here')
|
179 |
+
|
180 |
+
#openai.api_key = os.getenv('Your_Key_Here')
|
181 |
+
demo.launch()
|