Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,10 +5,9 @@ st.set_page_config(page_title="Common NLP Tasks")
|
|
| 5 |
st.title("Common NLP Tasks")
|
| 6 |
st.subheader(":point_left: Use the menu on the left to select a NLP task (click on > if closed).")
|
| 7 |
"""
|
| 8 |
-
[
|
| 13 |
expander.write("This web app allows you to perform common Natural Language Processing tasks, select a task below to get started.")
|
| 14 |
|
|
@@ -49,8 +48,7 @@ if option == "Extractive question answering":
|
|
| 49 |
with st.spinner(text="Getting answer..."):
|
| 50 |
answer = question_answerer(context=context, question=question)
|
| 51 |
answer = answer["answer"]
|
| 52 |
-
|
| 53 |
-
st.markdown(html_str, unsafe_allow_html=True)
|
| 54 |
elif source == "I want to upload a file":
|
| 55 |
uploaded_file = st.file_uploader("Choose a .txt file to upload", type=["txt"])
|
| 56 |
if uploaded_file is not None:
|
|
@@ -79,7 +77,7 @@ elif option == "Text summarization":
|
|
| 79 |
summarizer = summarization_model()
|
| 80 |
with st.spinner(text="Summarizing text..."):
|
| 81 |
summary = summarizer(text, max_length=130, min_length=30)
|
| 82 |
-
st.
|
| 83 |
|
| 84 |
elif source == "I want to upload a file":
|
| 85 |
uploaded_file = st.file_uploader("Choose a .txt file to upload", type=["txt"])
|
|
@@ -92,7 +90,7 @@ elif option == "Text summarization":
|
|
| 92 |
summarizer = summarization_model()
|
| 93 |
with st.spinner(text="Summarizing text..."):
|
| 94 |
summary = summarizer(text, max_length=130, min_length=30)
|
| 95 |
-
st.
|
| 96 |
|
| 97 |
elif option == "Text generation":
|
| 98 |
st.markdown("<h2 style='text-align: center; color:grey;'>Generate text</h2>", unsafe_allow_html=True)
|
|
@@ -103,4 +101,4 @@ elif option == "Text generation":
|
|
| 103 |
generator = generation_model()
|
| 104 |
with st.spinner(text="Generating text..."):
|
| 105 |
generated_text = generator(text, max_length=50)
|
| 106 |
-
st.
|
|
|
|
| 5 |
st.title("Common NLP Tasks")
|
| 6 |
st.subheader(":point_left: Use the menu on the left to select a NLP task (click on > if closed).")
|
| 7 |
"""
|
| 8 |
+
[](https://gitHub.com/OOlajide)
|
| 9 |
+
 [](https://twitter.com/sageOlamide)
|
| 10 |
"""
|
|
|
|
| 11 |
expander = st.sidebar.expander("About")
|
| 12 |
expander.write("This web app allows you to perform common Natural Language Processing tasks, select a task below to get started.")
|
| 13 |
|
|
|
|
| 48 |
with st.spinner(text="Getting answer..."):
|
| 49 |
answer = question_answerer(context=context, question=question)
|
| 50 |
answer = answer["answer"]
|
| 51 |
+
st.text(answer)
|
|
|
|
| 52 |
elif source == "I want to upload a file":
|
| 53 |
uploaded_file = st.file_uploader("Choose a .txt file to upload", type=["txt"])
|
| 54 |
if uploaded_file is not None:
|
|
|
|
| 77 |
summarizer = summarization_model()
|
| 78 |
with st.spinner(text="Summarizing text..."):
|
| 79 |
summary = summarizer(text, max_length=130, min_length=30)
|
| 80 |
+
st.text(summary[0]["summary_text"])
|
| 81 |
|
| 82 |
elif source == "I want to upload a file":
|
| 83 |
uploaded_file = st.file_uploader("Choose a .txt file to upload", type=["txt"])
|
|
|
|
| 90 |
summarizer = summarization_model()
|
| 91 |
with st.spinner(text="Summarizing text..."):
|
| 92 |
summary = summarizer(text, max_length=130, min_length=30)
|
| 93 |
+
st.text(summary[0]["summary_text"])
|
| 94 |
|
| 95 |
elif option == "Text generation":
|
| 96 |
st.markdown("<h2 style='text-align: center; color:grey;'>Generate text</h2>", unsafe_allow_html=True)
|
|
|
|
| 101 |
generator = generation_model()
|
| 102 |
with st.spinner(text="Generating text..."):
|
| 103 |
generated_text = generator(text, max_length=50)
|
| 104 |
+
st.text(generated_text[0]["generated_text"])
|