Update app.py
Browse files
app.py
CHANGED
@@ -37,40 +37,3 @@ if st.button('Run keyword search'):
|
|
37 |
else:
|
38 |
st.write('Write a query to submit your keyword search'); st.stop()
|
39 |
|
40 |
-
|
41 |
-
# if "answer" in qa_result.keys():
|
42 |
-
# answer_span, answer_score = qa_result["answer"], qa_result["score"]
|
43 |
-
# st.write(f'Answer: **{answer_span}**')
|
44 |
-
# start_par, stop_para = max(0, qa_result["start"]-86), min(qa_result["end"]+90, len(paragraph))
|
45 |
-
# answer_context = paragraph[start_par:stop_para].replace(answer_span, f'**{answer_span}**')
|
46 |
-
# st.write(f'Answer context (and score): ... _{answer_context}_ ... (score: {format(answer_score, ".3f")})')
|
47 |
-
|
48 |
-
# question_similarity = [ (hit['_score'], hit['_source']['content'][:200])
|
49 |
-
# for hit in result_first_two_hits ] # print(question_similarity)
|
50 |
-
|
51 |
-
# top_hit = result['hits']['hits'][0]
|
52 |
-
# context = top_hit['_source']['content']
|
53 |
-
# # context = r" Extractive Question Answering is the task of extracting
|
54 |
-
# # an answer from a text given a question. An example of a question
|
55 |
-
# # answering dataset is the SQuAD dataset, which is entirely based
|
56 |
-
# # on that task. If you would like to fine-tune a model on a SQuAD task,
|
57 |
-
# # you may leverage the `examples/pytorch/question-answering/run_squad.py` script."
|
58 |
-
# question = input # "What is extractive question answering?"
|
59 |
-
# # "What is a good example of a question answering dataset?"
|
60 |
-
# print(question)
|
61 |
-
# context = context[:5000]
|
62 |
-
# print(context)
|
63 |
-
# try:
|
64 |
-
# qa_result = pipe_exqa(question=question, context=context)
|
65 |
-
# except Exception as e:
|
66 |
-
# return {"output": str(e)}
|
67 |
-
|
68 |
-
# return {"output": str(qa_result)}
|
69 |
-
|
70 |
-
# answer = qa_result['answer']
|
71 |
-
# score = round(qa_result['score'], 4)
|
72 |
-
# span = f"start: {qa_result['start']}, end: {qa_result['end']}"
|
73 |
-
# # st.write(answer); st.write(f"score: {score}"); st.write(f"span: {span}")
|
74 |
-
# output = f"{str(answer)} \n {str(score)} \n {str(span)}"
|
75 |
-
|
76 |
-
# return {"output": output} or {"output": str(question_similarity)} or result or {"Hello": "World!"}
|
|
|
37 |
else:
|
38 |
st.write('Write a query to submit your keyword search'); st.stop()
|
39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|