Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -123,19 +123,19 @@ def main():
|
|
| 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 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
|
| 140 |
#main function to run
|
| 141 |
if __name__ == '__main__':
|
|
|
|
| 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__':
|