Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
@@ -15,7 +15,7 @@ st.write("Extractive question answering is a Natural Language Processing task wh
|
|
15 |
@st.cache_resource(show_spinner=True)
|
16 |
def question_model():
|
17 |
# call my model for question answering
|
18 |
-
model_name = "kxx-kkk/FYP_deberta-v3-base-
|
19 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
20 |
model = AutoModelForQuestionAnswering.from_pretrained(model_name)
|
21 |
question_answerer = pipeline("question-answering", model=model, tokenizer=tokenizer)
|
@@ -36,7 +36,7 @@ def question_answering(context, question):
|
|
36 |
# choose the source with different tabs
|
37 |
tab1, tab2 = st.tabs(["Input text", "Upload File"])
|
38 |
|
39 |
-
'''
|
40 |
# if type the text as input
|
41 |
with tab1:
|
42 |
# set the example
|
@@ -68,11 +68,11 @@ with tab1:
|
|
68 |
else:
|
69 |
question_answering(context, question)
|
70 |
|
71 |
-
'''
|
72 |
# if upload file as input
|
73 |
with tab2:
|
74 |
# provide upload place
|
75 |
-
uploaded_file = st.file_uploader("Choose a .
|
76 |
|
77 |
# transfer file to context and allow ask question, then perform question answering
|
78 |
if uploaded_file is not None:
|
@@ -90,3 +90,4 @@ with tab2:
|
|
90 |
|
91 |
st.markdown("<br><br><br><br><br>", unsafe_allow_html=True)
|
92 |
|
|
|
|
15 |
@st.cache_resource(show_spinner=True)
|
16 |
def question_model():
|
17 |
# call my model for question answering
|
18 |
+
model_name = "kxx-kkk/FYP_deberta-v3-base-squad2_mrqa"
|
19 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
20 |
model = AutoModelForQuestionAnswering.from_pretrained(model_name)
|
21 |
question_answerer = pipeline("question-answering", model=model, tokenizer=tokenizer)
|
|
|
36 |
# choose the source with different tabs
|
37 |
tab1, tab2 = st.tabs(["Input text", "Upload File"])
|
38 |
|
39 |
+
'''----- input text -----'''
|
40 |
# if type the text as input
|
41 |
with tab1:
|
42 |
# set the example
|
|
|
68 |
else:
|
69 |
question_answering(context, question)
|
70 |
|
71 |
+
'''----- upload file -----'''
|
72 |
# if upload file as input
|
73 |
with tab2:
|
74 |
# provide upload place
|
75 |
+
uploaded_file = st.file_uploader("Choose a .txt file to upload", type=["txt"])
|
76 |
|
77 |
# transfer file to context and allow ask question, then perform question answering
|
78 |
if uploaded_file is not None:
|
|
|
90 |
|
91 |
st.markdown("<br><br><br><br><br>", unsafe_allow_html=True)
|
92 |
|
93 |
+
|