tahirsher commited on
Commit
0a88fc0
·
verified ·
1 Parent(s): 6e63ee5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -9
app.py CHANGED
@@ -1,15 +1,12 @@
1
  import streamlit as st
2
- import base64
3
 
4
- # Function to set a background image
5
- def set_background(image_path):
6
- with open(image_path, "rb") as file:
7
- encoded_image = base64.b64encode(file.read()).decode()
8
  st.markdown(
9
  f"""
10
  <style>
11
  .stApp {{
12
- background-image: url("data:image/png;base64,{encoded_image}");
13
  background-size: cover;
14
  background-position: center;
15
  background-repeat: no-repeat;
@@ -23,9 +20,8 @@ def set_background(image_path):
23
  st.title("Word Cloud Application")
24
  st.write("This application displays a word cloud with a custom background.")
25
 
26
- # Set background image
27
- # Use either 1.png or 2.png as needed
28
- set_background("1.png") # Replace with the correct image path (e.g., "2.png")
29
 
30
  st.header("Word Clouds Display")
31
  st.write("Use the images in your layout or add functionality.")
 
1
  import streamlit as st
 
2
 
3
+ # Function to set a background image from a URL
4
+ def set_background_from_url(image_url):
 
 
5
  st.markdown(
6
  f"""
7
  <style>
8
  .stApp {{
9
+ background-image: url("{image_url}");
10
  background-size: cover;
11
  background-position: center;
12
  background-repeat: no-repeat;
 
20
  st.title("Word Cloud Application")
21
  st.write("This application displays a word cloud with a custom background.")
22
 
23
+ # Set background image from URL
24
+ set_background_from_url("https://huggingface.co/spaces/tahirsher/wellbeing_GenAI/blob/main/1.png")
 
25
 
26
  st.header("Word Clouds Display")
27
  st.write("Use the images in your layout or add functionality.")