Update app.py
Browse files
app.py
CHANGED
|
@@ -18,13 +18,13 @@ if st.button('Run keyword search'):
|
|
| 18 |
}}})
|
| 19 |
headers = {'Content-Type': 'application/json'}
|
| 20 |
response = requests.request("GET", url, headers=headers, data=payload)
|
| 21 |
-
|
| 22 |
# qa_result = pipe_exqa(question=question, context=paragraph)
|
| 23 |
|
| 24 |
except Exception as e:
|
| 25 |
qa_result = str(e)
|
| 26 |
|
| 27 |
-
top_5_hits =
|
| 28 |
top_5_text = [{'text': hit['_source']['content'][:500],
|
| 29 |
'confidence': hit['_score']} for hit in top_5_hits ]
|
| 30 |
|
|
|
|
| 18 |
}}})
|
| 19 |
headers = {'Content-Type': 'application/json'}
|
| 20 |
response = requests.request("GET", url, headers=headers, data=payload)
|
| 21 |
+
kws_result = response.json() # print(response.text)
|
| 22 |
# qa_result = pipe_exqa(question=question, context=paragraph)
|
| 23 |
|
| 24 |
except Exception as e:
|
| 25 |
qa_result = str(e)
|
| 26 |
|
| 27 |
+
top_5_hits = kws_result['hits']['hits'][:5] # print("First 5 results:")
|
| 28 |
top_5_text = [{'text': hit['_source']['content'][:500],
|
| 29 |
'confidence': hit['_score']} for hit in top_5_hits ]
|
| 30 |
|