Update app.py
Browse files
app.py
CHANGED
|
@@ -4,10 +4,6 @@ import re
|
|
| 4 |
import time
|
| 5 |
import requests
|
| 6 |
|
| 7 |
-
# if "visibility" not in st.session_state:
|
| 8 |
-
# st.session_state.visibility = "visible"
|
| 9 |
-
# st.session_state.disabled = False
|
| 10 |
-
|
| 11 |
|
| 12 |
HF_SPACES_API_KEY = st.secrets["HF_token"]
|
| 13 |
|
|
@@ -73,34 +69,10 @@ st.caption(''':green[Evidence:] :point_right: Moderna is suing Pfizer and BioNTe
|
|
| 73 |
def proc():
|
| 74 |
st.write(st.session_state.text_key)
|
| 75 |
|
| 76 |
-
# st.text_area('enter text', on_change=proc, key='text_key')
|
| 77 |
-
|
| 78 |
-
# claim_text = st.text_input(
|
| 79 |
-
# "Enter your claim 👇",
|
| 80 |
-
# label_visibility="visible",
|
| 81 |
-
# # placeholder=st.session_state.placeholder,
|
| 82 |
-
# )
|
| 83 |
-
|
| 84 |
-
# if claim_text:
|
| 85 |
-
# st.write("You entered: ", claim_text)
|
| 86 |
|
| 87 |
claim_text=st.text_area("Enter your claim:", on_change=proc, key='text_key')
|
| 88 |
|
| 89 |
-
# form_claim = st.form(key='my_claim')
|
| 90 |
-
# form_claim.text_input(label='Enter your claim')
|
| 91 |
-
# claim_text = form_claim.form_submit_button(label='Submit')
|
| 92 |
-
|
| 93 |
-
|
| 94 |
|
| 95 |
-
# evidence_text = st.text_input(
|
| 96 |
-
# "Enter your evidence 👇",
|
| 97 |
-
# label_visibility="visible",
|
| 98 |
-
# # disabled=st.session_state.disabled,
|
| 99 |
-
# # placeholder=st.session_state.placeholder,
|
| 100 |
-
# )
|
| 101 |
-
|
| 102 |
-
# if evidence_text:
|
| 103 |
-
# st.write("You entered: ", evidence_text)
|
| 104 |
|
| 105 |
evidence_text=st.text_area("Enter your evidence:")
|
| 106 |
|
|
@@ -109,7 +81,7 @@ evidence_text=st.text_area("Enter your evidence:")
|
|
| 109 |
# evidence_text = form_evidence.form_submit_button(label='Submit')
|
| 110 |
|
| 111 |
# if evidence_text:
|
| 112 |
-
st.caption(':green[Kindly hold on for a few minutes while the QA pairs are being generated]')
|
| 113 |
#st.caption(':blue[At times, you may encounter null/none outputs, which could be a result of a delay in loading the models through the API. If you experience this problem, kindly try again after a few minutes.]')
|
| 114 |
|
| 115 |
|
|
@@ -681,8 +653,6 @@ if claim_text and evidence_text:
|
|
| 681 |
df=claim(claim_text)
|
| 682 |
df["evidence"]=evidence_text
|
| 683 |
final_df = pd.DataFrame(columns=['Who Claims', 'What Claims', 'When Claims', 'Where Claims', 'Why Claims'])
|
| 684 |
-
|
| 685 |
-
|
| 686 |
final_df["Who Claims"]=gen_qa_who(df)
|
| 687 |
final_df["What Claims"]=gen_qa_what(df)
|
| 688 |
final_df["When Claims"]=gen_qa_when(df)
|
|
@@ -691,5 +661,3 @@ if claim_text and evidence_text:
|
|
| 691 |
st.table(final_df)
|
| 692 |
st.write(df["claim"])
|
| 693 |
st.write(df["evidence"])
|
| 694 |
-
# st.write(gen_qa_who(df))
|
| 695 |
-
# st.table(final_df)
|
|
|
|
| 4 |
import time
|
| 5 |
import requests
|
| 6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
HF_SPACES_API_KEY = st.secrets["HF_token"]
|
| 9 |
|
|
|
|
| 69 |
def proc():
|
| 70 |
st.write(st.session_state.text_key)
|
| 71 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
|
| 73 |
claim_text=st.text_area("Enter your claim:", on_change=proc, key='text_key')
|
| 74 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
|
| 77 |
evidence_text=st.text_area("Enter your evidence:")
|
| 78 |
|
|
|
|
| 81 |
# evidence_text = form_evidence.form_submit_button(label='Submit')
|
| 82 |
|
| 83 |
# if evidence_text:
|
| 84 |
+
#st.caption(':green[Kindly hold on for a few minutes while the QA pairs are being generated]')
|
| 85 |
#st.caption(':blue[At times, you may encounter null/none outputs, which could be a result of a delay in loading the models through the API. If you experience this problem, kindly try again after a few minutes.]')
|
| 86 |
|
| 87 |
|
|
|
|
| 653 |
df=claim(claim_text)
|
| 654 |
df["evidence"]=evidence_text
|
| 655 |
final_df = pd.DataFrame(columns=['Who Claims', 'What Claims', 'When Claims', 'Where Claims', 'Why Claims'])
|
|
|
|
|
|
|
| 656 |
final_df["Who Claims"]=gen_qa_who(df)
|
| 657 |
final_df["What Claims"]=gen_qa_what(df)
|
| 658 |
final_df["When Claims"]=gen_qa_when(df)
|
|
|
|
| 661 |
st.table(final_df)
|
| 662 |
st.write(df["claim"])
|
| 663 |
st.write(df["evidence"])
|
|
|
|
|
|