Spaces:
Running
Running
mehradans92
commited on
Commit
·
a63b5cf
1
Parent(s):
b6f12dc
added progress bar
Browse files
app.py
CHANGED
@@ -184,10 +184,15 @@ if searchButton:
|
|
184 |
|
185 |
# tokenize_callback()
|
186 |
|
|
|
|
|
|
|
187 |
def answer_callback(question_query):
|
188 |
global docs
|
189 |
# global pdf_info
|
|
|
190 |
if docs is None:
|
|
|
191 |
pdf_info = st.session_state['pdf_info']
|
192 |
print('buliding docs')
|
193 |
docs = paperqa.Docs()
|
@@ -200,9 +205,12 @@ def answer_callback(question_query):
|
|
200 |
docs.add(d, c)
|
201 |
# docs._build_faiss_index()
|
202 |
answer = docs.query(question_query)
|
203 |
-
print(answer.formatted_answer)
|
|
|
204 |
return answer.formatted_answer
|
205 |
|
|
|
|
|
206 |
form = st.form(key='question_form')
|
207 |
question_query = form.text_input("What do you wanna know from these papers?", placeholder='Input questions here...',
|
208 |
value='Write 50 words on CFD modeling')
|
|
|
184 |
|
185 |
# tokenize_callback()
|
186 |
|
187 |
+
|
188 |
+
|
189 |
+
|
190 |
def answer_callback(question_query):
|
191 |
global docs
|
192 |
# global pdf_info
|
193 |
+
my_bar = st.progress(0, text='Please wait...')
|
194 |
if docs is None:
|
195 |
+
my_bar.progress(0.2, text='Please wait...')
|
196 |
pdf_info = st.session_state['pdf_info']
|
197 |
print('buliding docs')
|
198 |
docs = paperqa.Docs()
|
|
|
205 |
docs.add(d, c)
|
206 |
# docs._build_faiss_index()
|
207 |
answer = docs.query(question_query)
|
208 |
+
# print(answer.formatted_answer)
|
209 |
+
my_bar.progress(1.0, text='Done!')
|
210 |
return answer.formatted_answer
|
211 |
|
212 |
+
|
213 |
+
|
214 |
form = st.form(key='question_form')
|
215 |
question_query = form.text_input("What do you wanna know from these papers?", placeholder='Input questions here...',
|
216 |
value='Write 50 words on CFD modeling')
|