Spaces:
Runtime error
Runtime error
changed UI
Browse files
app.py
CHANGED
@@ -167,10 +167,19 @@ def question_answer(question):
|
|
167 |
return generate_answer(question)
|
168 |
|
169 |
|
170 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
171 |
with gr.Row():
|
172 |
|
173 |
with gr.Group():
|
|
|
|
|
174 |
url = gr.Textbox(label='URL')
|
175 |
gr.Markdown("<center><h5>or<h5></center>")
|
176 |
file = gr.File(label='PDF', file_types=['.pdf'])
|
@@ -180,10 +189,12 @@ with gr.Blocks() as app:
|
|
180 |
btn1.click(load_corpus, inputs=[url, file], outputs=[stataus])
|
181 |
|
182 |
with gr.Group():
|
|
|
|
|
183 |
question = gr.Textbox(label='question')
|
184 |
btn2 = gr.Button(value='Submit')
|
185 |
btn2.style(full_width=True)
|
186 |
answer = gr.Textbox(label='answer')
|
187 |
btn2.click(question_answer, inputs=[question], outputs=[answer])
|
188 |
|
189 |
-
|
|
|
167 |
return generate_answer(question)
|
168 |
|
169 |
|
170 |
+
title = 'BookGPT'
|
171 |
+
description = "BookGPT allows you to input an entire book and ask questions about its contents. This app uses GPT-3 to generate answers based on the book's information. BookGPT has ability to add reference to the specific page number from where the information was found. This adds credibility to the answers generated also helps you locate the relevant information in the book."
|
172 |
+
|
173 |
+
with gr.Blocks() as demo:
|
174 |
+
|
175 |
+
gr.Markdown(f'<center><h1>{title}</h1></center>')
|
176 |
+
gr.Markdown(description)
|
177 |
+
|
178 |
with gr.Row():
|
179 |
|
180 |
with gr.Group():
|
181 |
+
gr.Markdown('### Step 1: Provide URL or Upload PDF')
|
182 |
+
gr.Markdown('<br>')
|
183 |
url = gr.Textbox(label='URL')
|
184 |
gr.Markdown("<center><h5>or<h5></center>")
|
185 |
file = gr.File(label='PDF', file_types=['.pdf'])
|
|
|
189 |
btn1.click(load_corpus, inputs=[url, file], outputs=[stataus])
|
190 |
|
191 |
with gr.Group():
|
192 |
+
gr.Markdown('### Step 2: Now you can ask Quesitons:')
|
193 |
+
gr.Markdown('<br>')
|
194 |
question = gr.Textbox(label='question')
|
195 |
btn2 = gr.Button(value='Submit')
|
196 |
btn2.style(full_width=True)
|
197 |
answer = gr.Textbox(label='answer')
|
198 |
btn2.click(question_answer, inputs=[question], outputs=[answer])
|
199 |
|
200 |
+
demo.launch()
|