tarrasyed19472007 commited on
Commit
7de714b
·
verified ·
1 Parent(s): 5b26654

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -1
app.py CHANGED
@@ -8,7 +8,7 @@ def load_model():
8
  emotion_classifier = pipeline("text-classification", model="j-hartmann/emotion-english-distilroberta-base")
9
  return emotion_classifier
10
  except Exception as e:
11
- st.error(f"Error loading model: {str(e)}")
12
  return None
13
 
14
  emotion_classifier = load_model()
@@ -95,6 +95,24 @@ def get_well_being_suggestions(emotion):
95
 
96
  # Streamlit UI
97
  def main():
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98
  # Custom Styling for purple background and white text color
99
  st.markdown("""
100
  <style>
 
8
  emotion_classifier = pipeline("text-classification", model="j-hartmann/emotion-english-distilroberta-base")
9
  return emotion_classifier
10
  except Exception as e:
11
+ st.error(f"Error loading model: {str(e)}") # Error handling
12
  return None
13
 
14
  emotion_classifier = load_model()
 
95
 
96
  # Streamlit UI
97
  def main():
98
+ # Allow user to upload an image for the background
99
+ uploaded_file = st.file_uploader("Upload a background image", type=["png", "jpg", "jpeg"])
100
+
101
+ # Check if an image is uploaded
102
+ if uploaded_file is not None:
103
+ st.image(uploaded_file, use_column_width=True)
104
+ else:
105
+ # If no image uploaded, use a default URL for a peaceful background
106
+ st.markdown("""
107
+ <style>
108
+ .stApp {
109
+ background-image: url('https://example.com/your-peaceful-image.jpg');
110
+ background-size: cover;
111
+ background-position: center;
112
+ }
113
+ </style>
114
+ """, unsafe_allow_html=True)
115
+
116
  # Custom Styling for purple background and white text color
117
  st.markdown("""
118
  <style>