Spaces:
Running
Running
Commit
·
3501948
1
Parent(s):
c0af0be
Update app.py
Browse files
app.py
CHANGED
@@ -162,31 +162,24 @@ def question_answer(url, file, question):
|
|
162 |
|
163 |
title = 'PDF GPT'
|
164 |
description = """PDF GPT allows you to chat with a PDF file using GPT functionalities. The application intelligently breaks the document into smaller chunks and employs a powerful Deep Averaging Network Encoder to generate embeddings. To generate a summary for each chunk, PDF GPT utilizes Open AI as its data layer.
|
165 |
-
PDF GPT uses a KNN algorithm to return the top-n embedding from each chunk and uses a custom logic to generate a response.
|
166 |
-
The application also leverages important document sections to generate precise responses, and
|
167 |
can even provide the page number where the information is located, adding credibility to the responses and helping to locate pertinent information quickly."""
|
168 |
|
169 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
170 |
|
171 |
-
gr.Markdown(f'<center><h1>{title}</h1></center>')
|
172 |
-
gr.Markdown(description)
|
173 |
-
|
174 |
-
with gr.Row():
|
175 |
-
|
176 |
-
with gr.Group():
|
177 |
-
url = gr.Textbox(label='URL')
|
178 |
-
gr.Markdown("<center><h6>or<h6></center>")
|
179 |
-
file = gr.File(label='PDF', file_types=['.pdf'])
|
180 |
-
question = gr.Textbox(label='Enter your question here')
|
181 |
-
btn = gr.Button(value='Submit')
|
182 |
-
btn.style(full_width=True)
|
183 |
-
|
184 |
-
with gr.Group():
|
185 |
-
answer = gr.Textbox(label='The answer to your question is :')
|
186 |
-
|
187 |
-
btn.click(question_answer, inputs=[url, file, question], outputs=[answer])
|
188 |
-
|
189 |
-
demo.launch()
|
190 |
|
191 |
# import streamlit as st
|
192 |
|
|
|
162 |
|
163 |
title = 'PDF GPT'
|
164 |
description = """PDF GPT allows you to chat with a PDF file using GPT functionalities. The application intelligently breaks the document into smaller chunks and employs a powerful Deep Averaging Network Encoder to generate embeddings. To generate a summary for each chunk, PDF GPT utilizes Open AI as its data layer.
|
165 |
+
PDF GPT uses a KNN algorithm to return the top-n embedding from each chunk and uses a custom logic to generate a response. The application also leverages important document sections to generate precise responses, and
|
|
|
166 |
can even provide the page number where the information is located, adding credibility to the responses and helping to locate pertinent information quickly."""
|
167 |
|
168 |
+
gradio_interface = gr.Interface(
|
169 |
+
fn=question_answer,
|
170 |
+
inputs=[
|
171 |
+
gr.inputs.Textbox(label="Enter PDF URL here"),
|
172 |
+
gr.inputs.File(label="Upload your PDF/ Research Paper / Book here", type=".pdf"),
|
173 |
+
gr.inputs.Textbox(label="Enter your question here")
|
174 |
+
],
|
175 |
+
outputs=gr.outputs.Textbox(label="The answer to your question is:"),
|
176 |
+
title=title,
|
177 |
+
description=description,
|
178 |
+
theme="dark"
|
179 |
+
)
|
180 |
+
|
181 |
+
gradio_interface.launch()
|
182 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
183 |
|
184 |
# import streamlit as st
|
185 |
|