Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,3 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import urllib.request
|
| 2 |
import fitz
|
| 3 |
import re
|
|
@@ -195,8 +233,8 @@ with gr.Blocks() as demo:
|
|
| 195 |
with gr.Row():
|
| 196 |
|
| 197 |
with gr.Group():
|
| 198 |
-
|
| 199 |
-
|
| 200 |
url = gr.Textbox(label='Enter PDF URL here')
|
| 201 |
gr.Markdown("<center><h4>OR<h4></center>")
|
| 202 |
file = gr.File(label='Upload your PDF/ Research Paper / Book here', file_types=['.pdf'])
|
|
@@ -207,8 +245,8 @@ with gr.Blocks() as demo:
|
|
| 207 |
with gr.Group():
|
| 208 |
answer = gr.Textbox(label='The answer to your question is :')
|
| 209 |
|
| 210 |
-
openAI_key = os.getenv('Your_Key_Here')
|
| 211 |
btn.click(question_answer, inputs=[url, file, question,openAI_key], outputs=[answer])
|
|
|
|
| 212 |
demo.launch()
|
| 213 |
|
| 214 |
|
|
@@ -235,4 +273,4 @@ demo.launch()
|
|
| 235 |
# # Define the button action
|
| 236 |
# if btn:
|
| 237 |
# answer_value = question_answer(url, file, question)
|
| 238 |
-
# answer.value = answer_value
|
|
|
|
| 1 |
+
Hugging Face's logo
|
| 2 |
+
Hugging Face
|
| 3 |
+
Search models, datasets, users...
|
| 4 |
+
Models
|
| 5 |
+
Datasets
|
| 6 |
+
Spaces
|
| 7 |
+
Docs
|
| 8 |
+
Solutions
|
| 9 |
+
Pricing
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
Spaces:
|
| 14 |
+
|
| 15 |
+
bhaskartripathi
|
| 16 |
+
/
|
| 17 |
+
pdfChatter Copied
|
| 18 |
+
like
|
| 19 |
+
5
|
| 20 |
+
App
|
| 21 |
+
Files and versions
|
| 22 |
+
Community
|
| 23 |
+
2
|
| 24 |
+
pdfChatter
|
| 25 |
+
/
|
| 26 |
+
app.py
|
| 27 |
+
bhaskartripathi's picture
|
| 28 |
+
bhaskartripathi
|
| 29 |
+
Update app.py
|
| 30 |
+
1605348
|
| 31 |
+
2 days ago
|
| 32 |
+
raw
|
| 33 |
+
history
|
| 34 |
+
blame
|
| 35 |
+
contribute
|
| 36 |
+
delete
|
| 37 |
+
No virus
|
| 38 |
+
8.67 kB
|
| 39 |
import urllib.request
|
| 40 |
import fitz
|
| 41 |
import re
|
|
|
|
| 233 |
with gr.Row():
|
| 234 |
|
| 235 |
with gr.Group():
|
| 236 |
+
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>')
|
| 237 |
+
openAI_key=gr.Textbox(label='Enter your OpenAI API key here')
|
| 238 |
url = gr.Textbox(label='Enter PDF URL here')
|
| 239 |
gr.Markdown("<center><h4>OR<h4></center>")
|
| 240 |
file = gr.File(label='Upload your PDF/ Research Paper / Book here', file_types=['.pdf'])
|
|
|
|
| 245 |
with gr.Group():
|
| 246 |
answer = gr.Textbox(label='The answer to your question is :')
|
| 247 |
|
|
|
|
| 248 |
btn.click(question_answer, inputs=[url, file, question,openAI_key], outputs=[answer])
|
| 249 |
+
#openai.api_key = os.getenv('Your_Key_Here')
|
| 250 |
demo.launch()
|
| 251 |
|
| 252 |
|
|
|
|
| 273 |
# # Define the button action
|
| 274 |
# if btn:
|
| 275 |
# answer_value = question_answer(url, file, question)
|
| 276 |
+
# answer.value = answer_value
|