OOlajide commited on
Commit
d6cc54f
1 Parent(s): cd1e7d7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -8
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
- [![](https://img.shields.io/github/followers/OOlajide?label=@OOlajide&style=social)](https://gitHub.com/OOlajide)
9
- &nbsp[![](https://img.shields.io/twitter/follow/sageOlamide?label=%40sageOlamide&style=social)](https://www.twitter.com/sageOlamide)
10
  """
11
-
12
  expander = st.sidebar.expander("About")
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
- html_str = f"<p style='color:red;'>{answer}</p>"
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.write(summary[0]["summary_text"])
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.write(summary[0]["summary_text"])
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.write(generated_text[0]["generated_text"])
 
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://img.shields.io/github/followers/OOlajide?label=OOlajide&style=social)](https://gitHub.com/OOlajide)
9
+ &nbsp[![](https://img.shields.io/twitter/follow/sageOlamide?label=@sageOlamide&style=social)](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"])