Ashendilantha commited on
Commit
9603614
·
verified ·
1 Parent(s): c895896

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -1
app.py CHANGED
@@ -8,7 +8,14 @@ from nltk.stem import WordNetLemmatizer
8
  from transformers import pipeline
9
  from PIL import Image
10
 
11
- # Download required NLTK data
 
 
 
 
 
 
 
12
  nltk.download('stopwords')
13
  nltk.download('wordnet')
14
  nltk.download('omw-1.4')
@@ -17,6 +24,7 @@ nltk.download('omw-1.4')
17
  news_classifier = pipeline("text-classification", model="Oneli/News_Classification")
18
  qa_pipeline = pipeline("question-answering", model="distilbert-base-cased-distilled-squad")
19
 
 
20
  # Label Mapping
21
  label_mapping = {
22
  "LABEL_0": "Business",
 
8
  from transformers import pipeline
9
  from PIL import Image
10
 
11
+ # Set page config FIRST
12
+ device_type = st.radio("Are you using a mobile device or a PC?", ["Mobile", "PC"])
13
+ if device_type == "Mobile":
14
+ st.set_page_config(page_title="News Classifier", page_icon="📰", layout="centered")
15
+ else:
16
+ st.set_page_config(page_title="News Classifier", page_icon="📰", layout="wide")
17
+
18
+ # Now the rest of the imports and app logic continue
19
  nltk.download('stopwords')
20
  nltk.download('wordnet')
21
  nltk.download('omw-1.4')
 
24
  news_classifier = pipeline("text-classification", model="Oneli/News_Classification")
25
  qa_pipeline = pipeline("question-answering", model="distilbert-base-cased-distilled-squad")
26
 
27
+
28
  # Label Mapping
29
  label_mapping = {
30
  "LABEL_0": "Business",