Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -24,7 +24,7 @@ def draw_all(
|
|
| 24 |
1. Advanced Text Summarizer
|
| 25 |
2. Key Word Extractor
|
| 26 |
3. Question Answering
|
| 27 |
-
4.
|
| 28 |
|
| 29 |
```
|
| 30 |
"""
|
|
@@ -40,7 +40,7 @@ with st.sidebar:
|
|
| 40 |
def main():
|
| 41 |
st.title("NLP IE Web App")
|
| 42 |
menu = ["--Select--","Summarizer",
|
| 43 |
-
"Keyword Extractor","Question Answering","
|
| 44 |
choice = st.sidebar.selectbox("What task would you like to do?", menu)
|
| 45 |
if choice=="--Select--":
|
| 46 |
|
|
@@ -120,20 +120,22 @@ def main():
|
|
| 120 |
generated_text = '. '.join(list(map(lambda x: x.strip().capitalize(), generated_text.split('.'))))
|
| 121 |
st.write(f" Here's your Answer :\n {generated_text}")
|
| 122 |
|
| 123 |
-
elif choice=="
|
| 124 |
-
st.subheader("
|
| 125 |
-
st.write(" Enter the
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
if
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
|
|
|
|
|
|
| 137 |
|
| 138 |
#main function to run
|
| 139 |
if __name__ == '__main__':
|
|
|
|
| 24 |
1. Advanced Text Summarizer
|
| 25 |
2. Key Word Extractor
|
| 26 |
3. Question Answering
|
| 27 |
+
4. Question Generation
|
| 28 |
|
| 29 |
```
|
| 30 |
"""
|
|
|
|
| 40 |
def main():
|
| 41 |
st.title("NLP IE Web App")
|
| 42 |
menu = ["--Select--","Summarizer",
|
| 43 |
+
"Keyword Extractor","Question Answering","Question Generation"]
|
| 44 |
choice = st.sidebar.selectbox("What task would you like to do?", menu)
|
| 45 |
if choice=="--Select--":
|
| 46 |
|
|
|
|
| 120 |
generated_text = '. '.join(list(map(lambda x: x.strip().capitalize(), generated_text.split('.'))))
|
| 121 |
st.write(f" Here's your Answer :\n {generated_text}")
|
| 122 |
|
| 123 |
+
elif choice=="Question Generation":
|
| 124 |
+
st.subheader("Question Generation")
|
| 125 |
+
st.write(" Enter the text to get questions generated !")
|
| 126 |
+
question_generator = pipeline("question-generation",model="mrm8488/t5-base-finetuned-question-generation-ap",tokenizer="mrm8488/t5-base-finetuned-question-generation-ap"
|
| 127 |
+
text_input2 = st.text_area("Your Text","Enter the Text to complete")
|
| 128 |
+
|
| 129 |
+
|
| 130 |
+
if text_input2:
|
| 131 |
+
# Extract named entities from the text
|
| 132 |
+
entities = extract_entities(text_input2)
|
| 133 |
+
# Generate questions based on the text using the T5 model
|
| 134 |
+
questions = question_generator(text_input2, max_length=30)
|
| 135 |
+
# Display the generated questions
|
| 136 |
+
st.subheader("Generated questions")
|
| 137 |
+
for question in questions:
|
| 138 |
+
st.write(question["question"])
|
| 139 |
|
| 140 |
#main function to run
|
| 141 |
if __name__ == '__main__':
|