Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,7 +2,10 @@ import gradio as gr
|
|
| 2 |
|
| 3 |
description = """Do you have a long document and a bunch of questions that can be answered given the data in this file?
|
| 4 |
Fear not for this demo is for you.
|
| 5 |
-
Upload your pdf, ask your questions and wait for the magic to happen.
|
|
|
|
|
|
|
|
|
|
| 6 |
title = "QA answering from a pdf."
|
| 7 |
|
| 8 |
import numpy as np
|
|
@@ -82,7 +85,7 @@ def encode_docs(docs,maxlen = 64, stride = 32):
|
|
| 82 |
|
| 83 |
def predict(query,data):
|
| 84 |
name_to_save = data.name.split("/")[-1].split(".")[0][:-8]
|
| 85 |
-
|
| 86 |
st = str([query,name_to_save])
|
| 87 |
st_hashed = str(hashlib.sha256(st.encode()).hexdigest()) #just to speed up examples load
|
| 88 |
hist = st + " " + st_hashed
|
|
|
|
| 2 |
|
| 3 |
description = """Do you have a long document and a bunch of questions that can be answered given the data in this file?
|
| 4 |
Fear not for this demo is for you.
|
| 5 |
+
Upload your pdf, ask your questions and wait for the magic to happen.
|
| 6 |
+
DISCLAIMER: I do no have idea what happens to the pdfs that you upload and who has access to them so make sure there is nothing confidential there.
|
| 7 |
+
On top of that, to speed up examples calculation, your query and the name of the document will be logged in.
|
| 8 |
+
"""
|
| 9 |
title = "QA answering from a pdf."
|
| 10 |
|
| 11 |
import numpy as np
|
|
|
|
| 85 |
|
| 86 |
def predict(query,data):
|
| 87 |
name_to_save = data.name.split("/")[-1].split(".")[0][:-8]
|
| 88 |
+
|
| 89 |
st = str([query,name_to_save])
|
| 90 |
st_hashed = str(hashlib.sha256(st.encode()).hexdigest()) #just to speed up examples load
|
| 91 |
hist = st + " " + st_hashed
|