Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -30,13 +30,14 @@ def generation_model():
|
|
30 |
return generator
|
31 |
|
32 |
if option == "Extractive question answering":
|
33 |
-
st.markdown("<h2 style='text-align: center; color:
|
34 |
source = st.radio("How would you like to start? Choose an option below", ["I want to input some text", "I want to upload a file"])
|
|
|
35 |
if source == "I want to input some text":
|
36 |
with open("sample.txt", "r") as text_file:
|
37 |
sample_text = text_file.read()
|
38 |
-
context = st.text_area(
|
39 |
-
question = st.text_input(label="
|
40 |
button = st.button("Get answer")
|
41 |
if button:
|
42 |
with st.spinner(text="Loading question model..."):
|
@@ -51,7 +52,7 @@ if option == "Extractive question answering":
|
|
51 |
if uploaded_file is not None:
|
52 |
raw_text = str(uploaded_file.read(),"utf-8")
|
53 |
context = st.text_area("", value=raw_text, height=330)
|
54 |
-
question = st.text_input(label="Enter your question")
|
55 |
button = st.button("Get answer")
|
56 |
if button:
|
57 |
with st.spinner(text="Loading summarization model..."):
|
@@ -62,7 +63,7 @@ if option == "Extractive question answering":
|
|
62 |
st.text(answer)
|
63 |
|
64 |
elif option == "Text summarization":
|
65 |
-
st.markdown("<h2 style='text-align: center; color:
|
66 |
source = st.radio("How would you like to start? Choose an option below", ["I want to input some text", "I want to upload a file"])
|
67 |
if source == "I want to input some text":
|
68 |
with open("sample.txt", "r") as text_file:
|
|
|
30 |
return generator
|
31 |
|
32 |
if option == "Extractive question answering":
|
33 |
+
st.markdown("<h2 style='text-align: center; color:grey;'>Extract answer from text</h2>", unsafe_allow_html=True)
|
34 |
source = st.radio("How would you like to start? Choose an option below", ["I want to input some text", "I want to upload a file"])
|
35 |
+
sample_question = "What did the shepherd boy do to amuse himself?"
|
36 |
if source == "I want to input some text":
|
37 |
with open("sample.txt", "r") as text_file:
|
38 |
sample_text = text_file.read()
|
39 |
+
context = st.text_area("Use the example below or input your own text in English (10,000 characters max)", value=sample_text, max_chars=10000, height=330)
|
40 |
+
question = st.text_input(label="Use the question below or enter your own question", value=sample_question)
|
41 |
button = st.button("Get answer")
|
42 |
if button:
|
43 |
with st.spinner(text="Loading question model..."):
|
|
|
52 |
if uploaded_file is not None:
|
53 |
raw_text = str(uploaded_file.read(),"utf-8")
|
54 |
context = st.text_area("", value=raw_text, height=330)
|
55 |
+
question = st.text_input(label="Enter your question", value=sample_question)
|
56 |
button = st.button("Get answer")
|
57 |
if button:
|
58 |
with st.spinner(text="Loading summarization model..."):
|
|
|
63 |
st.text(answer)
|
64 |
|
65 |
elif option == "Text summarization":
|
66 |
+
st.markdown("<h2 style='text-align: center; color:grey;'>Summarize text</h2>", unsafe_allow_html=True)
|
67 |
source = st.radio("How would you like to start? Choose an option below", ["I want to input some text", "I want to upload a file"])
|
68 |
if source == "I want to input some text":
|
69 |
with open("sample.txt", "r") as text_file:
|