Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -22,7 +22,7 @@ def draw_all(
|
|
| 22 |
```python
|
| 23 |
# Key Features of this App.
|
| 24 |
1. Advanced Text Summarizer
|
| 25 |
-
2.
|
| 26 |
3. Question Answering
|
| 27 |
4. Text Completion
|
| 28 |
|
|
@@ -40,7 +40,7 @@ with st.sidebar:
|
|
| 40 |
def main():
|
| 41 |
st.title("NLP IE Web App")
|
| 42 |
menu = ["--Select--","Summarizer",
|
| 43 |
-
"
|
| 44 |
choice = st.sidebar.selectbox("What task would you like to do?", menu)
|
| 45 |
if choice=="--Select--":
|
| 46 |
|
|
@@ -84,29 +84,29 @@ def main():
|
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
-
elif choice=="
|
| 88 |
-
st.subheader("
|
| 89 |
#loading the pipeline
|
| 90 |
sentiment_analysis = pipeline("sentiment-analysis")
|
| 91 |
-
st.
|
|
|
|
|
|
|
| 92 |
|
| 93 |
-
raw_text = st.text_area("Your Text","Enter Text Here")
|
| 94 |
if raw_text !="Enter Text Here":
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
elif choice=="Question Answering":
|
| 107 |
st.subheader("Question Answering")
|
| 108 |
st.write(" Enter the Context and ask the Question to find out the Answer !")
|
| 109 |
-
question_answering = pipeline("question-answering")
|
| 110 |
|
| 111 |
|
| 112 |
context = st.text_area("Context","Enter the Context Here")
|
|
|
|
| 22 |
```python
|
| 23 |
# Key Features of this App.
|
| 24 |
1. Advanced Text Summarizer
|
| 25 |
+
2. Key Word Extractor
|
| 26 |
3. Question Answering
|
| 27 |
4. Text Completion
|
| 28 |
|
|
|
|
| 40 |
def main():
|
| 41 |
st.title("NLP IE Web App")
|
| 42 |
menu = ["--Select--","Summarizer",
|
| 43 |
+
"Keyword Extractor","Question Answering","Text Completion"]
|
| 44 |
choice = st.sidebar.selectbox("What task would you like to do?", menu)
|
| 45 |
if choice=="--Select--":
|
| 46 |
|
|
|
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
+
elif choice=="Keyword Extractor":
|
| 88 |
+
st.subheader("Keyword Extraction")
|
| 89 |
#loading the pipeline
|
| 90 |
sentiment_analysis = pipeline("sentiment-analysis")
|
| 91 |
+
raw_text = st.text_area("Enter some text:")
|
| 92 |
+
model_name = "yanekyuk/bert-uncased-keyword"
|
| 93 |
+
keyword_extractor = pipeline("text2text-generation", model=model_name, tokenizer=model_name, config={"wordwise": True})
|
| 94 |
|
|
|
|
| 95 |
if raw_text !="Enter Text Here":
|
| 96 |
+
if st.button("Extract Keywords"):
|
| 97 |
+
# Extract keywords using the model
|
| 98 |
+
keywords = keyword_extractor(input_text, max_length=20, do_sample=False)[0]["generated_text"]
|
| 99 |
+
# Display the extracted keywords
|
| 100 |
+
st.write("Keywords:", keywords)
|
| 101 |
+
|
| 102 |
+
|
| 103 |
+
# Load the keyword extraction model
|
| 104 |
+
|
| 105 |
+
|
|
|
|
| 106 |
elif choice=="Question Answering":
|
| 107 |
st.subheader("Question Answering")
|
| 108 |
st.write(" Enter the Context and ask the Question to find out the Answer !")
|
| 109 |
+
question_answering = pipeline("question-answering", model = "distilbert-base-cased-distilled-squad")
|
| 110 |
|
| 111 |
|
| 112 |
context = st.text_area("Context","Enter the Context Here")
|