Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,12 +1,17 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
import pandas as pd
|
| 3 |
import re
|
|
|
|
| 4 |
from nltk.tokenize import word_tokenize
|
| 5 |
from nltk.corpus import stopwords
|
| 6 |
from nltk.stem import WordNetLemmatizer
|
| 7 |
from transformers import pipeline
|
| 8 |
from PIL import Image
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
# Load Models
|
| 11 |
news_classifier = pipeline("text-classification", model="Oneli/News_Classification")
|
| 12 |
|
|
@@ -147,4 +152,3 @@ if question:
|
|
| 147 |
st.subheader("Confidence")
|
| 148 |
st.progress(float(result["score"]))
|
| 149 |
st.write(f"Confidence Score: {result['score']:.4f}")
|
| 150 |
-
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import pandas as pd
|
| 3 |
import re
|
| 4 |
+
import nltk
|
| 5 |
from nltk.tokenize import word_tokenize
|
| 6 |
from nltk.corpus import stopwords
|
| 7 |
from nltk.stem import WordNetLemmatizer
|
| 8 |
from transformers import pipeline
|
| 9 |
from PIL import Image
|
| 10 |
|
| 11 |
+
# Download NLTK resources
|
| 12 |
+
nltk.download('stopwords')
|
| 13 |
+
nltk.download('punkt') # For tokenization
|
| 14 |
+
|
| 15 |
# Load Models
|
| 16 |
news_classifier = pipeline("text-classification", model="Oneli/News_Classification")
|
| 17 |
|
|
|
|
| 152 |
st.subheader("Confidence")
|
| 153 |
st.progress(float(result["score"]))
|
| 154 |
st.write(f"Confidence Score: {result['score']:.4f}")
|
|
|