Spaces:
Runtime error
Runtime error
Commit
Β·
ee33bad
1
Parent(s):
b7e15be
increase limits
Browse files
app.py
CHANGED
@@ -154,7 +154,7 @@ def card(title, context, score, link, supporting):
|
|
154 |
<br>
|
155 |
<span>
|
156 |
{context}
|
157 |
-
[<b>
|
158 |
</span>
|
159 |
<br>
|
160 |
<b>From <a href="{link}">{title}</a></b>
|
@@ -206,8 +206,8 @@ with st.expander("Settings (strictness, context limit, top hits)"):
|
|
206 |
use_reranking = st.radio(
|
207 |
"Use Reranking? Reranking will rerank the top hits using semantic similarity of document and query.",
|
208 |
('yes', 'no'))
|
209 |
-
top_hits_limit = st.slider('Top hits? How many documents to use for reranking. Larger is slower but higher quality', 10, 300,
|
210 |
-
context_lim = st.slider('Context limit? How many documents to use for answering from. Larger is slower but higher quality', 10, 300,
|
211 |
|
212 |
# def paraphrase(text, max_length=128):
|
213 |
# input_ids = queryexp_tokenizer.encode(text, return_tensors="pt", add_special_tokens=True)
|
@@ -321,7 +321,7 @@ def run_query(query):
|
|
321 |
ctx = ctx.replace(answer, f"<mark>{answer}</mark>")
|
322 |
# .replace( '<cite', '<a').replace('</cite', '</a').replace('data-doi="', 'href="https://scite.ai/reports/')
|
323 |
title = r.get("title", '')
|
324 |
-
score = round(r["score"], 4)
|
325 |
card(title, ctx, score, r['link'], r['doi'])
|
326 |
|
327 |
query = st.text_input("Ask scientific literature a question", "")
|
|
|
154 |
<br>
|
155 |
<span>
|
156 |
{context}
|
157 |
+
[<b>Confidence: </b>{score}%]
|
158 |
</span>
|
159 |
<br>
|
160 |
<b>From <a href="{link}">{title}</a></b>
|
|
|
206 |
use_reranking = st.radio(
|
207 |
"Use Reranking? Reranking will rerank the top hits using semantic similarity of document and query.",
|
208 |
('yes', 'no'))
|
209 |
+
top_hits_limit = st.slider('Top hits? How many documents to use for reranking. Larger is slower but higher quality', 10, 300, 100)
|
210 |
+
context_lim = st.slider('Context limit? How many documents to use for answering from. Larger is slower but higher quality', 10, 300, 10)
|
211 |
|
212 |
# def paraphrase(text, max_length=128):
|
213 |
# input_ids = queryexp_tokenizer.encode(text, return_tensors="pt", add_special_tokens=True)
|
|
|
321 |
ctx = ctx.replace(answer, f"<mark>{answer}</mark>")
|
322 |
# .replace( '<cite', '<a').replace('</cite', '</a').replace('data-doi="', 'href="https://scite.ai/reports/')
|
323 |
title = r.get("title", '')
|
324 |
+
score = round(round(r["score"], 4) * 100, 2)
|
325 |
card(title, ctx, score, r['link'], r['doi'])
|
326 |
|
327 |
query = st.text_input("Ask scientific literature a question", "")
|