Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -29,6 +29,13 @@ label_mapping = {
|
|
| 29 |
# Store classified article for QA
|
| 30 |
context_storage = {"context": "", "bulk_context": "", "num_articles": 0}
|
| 31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
# Text Cleaning Functions
|
| 33 |
def clean_text(text):
|
| 34 |
text = text.lower()
|
|
@@ -91,7 +98,6 @@ def chatbot_response(history, user_input, text_input=None, file_input=None):
|
|
| 91 |
return history, answer
|
| 92 |
|
| 93 |
# Streamlit App Layout
|
| 94 |
-
st.set_page_config(page_title="News Classifier", page_icon="📰")
|
| 95 |
cover_image = Image.open("cover.png") # Ensure this image exists
|
| 96 |
st.image(cover_image, caption="News Classifier 📢", use_container_width=True)
|
| 97 |
|
|
@@ -133,3 +139,4 @@ if st.button("✉ Send"):
|
|
| 133 |
for q, a in history:
|
| 134 |
st.write(f"*Q:* {q}")
|
| 135 |
st.write(f"*A:* {a}")
|
|
|
|
|
|
| 29 |
# Store classified article for QA
|
| 30 |
context_storage = {"context": "", "bulk_context": "", "num_articles": 0}
|
| 31 |
|
| 32 |
+
# Detect device type
|
| 33 |
+
device_type = st.radio("Are you using a mobile device or a PC?", ["Mobile", "PC"])
|
| 34 |
+
if device_type == "Mobile":
|
| 35 |
+
st.set_page_config(layout="centered")
|
| 36 |
+
else:
|
| 37 |
+
st.set_page_config(layout="wide")
|
| 38 |
+
|
| 39 |
# Text Cleaning Functions
|
| 40 |
def clean_text(text):
|
| 41 |
text = text.lower()
|
|
|
|
| 98 |
return history, answer
|
| 99 |
|
| 100 |
# Streamlit App Layout
|
|
|
|
| 101 |
cover_image = Image.open("cover.png") # Ensure this image exists
|
| 102 |
st.image(cover_image, caption="News Classifier 📢", use_container_width=True)
|
| 103 |
|
|
|
|
| 139 |
for q, a in history:
|
| 140 |
st.write(f"*Q:* {q}")
|
| 141 |
st.write(f"*A:* {a}")
|
| 142 |
+
|