muqeet1234 commited on
Commit
e599666
·
verified ·
1 Parent(s): d96653f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -1
app.py CHANGED
@@ -1,11 +1,37 @@
1
  import streamlit as st
2
  from PIL import Image, ImageEnhance
3
  import io
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
 
5
  st.title("Image Editor")
6
 
7
  # Upload an image
8
- uploaded_image = st.file_uploader("Image Editor", type=["jpg", "jpeg", "png"])
9
 
10
  if uploaded_image:
11
  image = Image.open(uploaded_image)
 
1
  import streamlit as st
2
  from PIL import Image, ImageEnhance
3
  import io
4
+ import requests
5
+
6
+ # Fetch the background image from the link
7
+ background_url = "https://drive.google.com/uc?id=1I9IbcLTS2FIsWfAa1A5XA-2NdrMIuy-t"
8
+
9
+ def set_background_from_url(url):
10
+ response = requests.get(url)
11
+ if response.status_code == 200:
12
+ with open("background.jpg", "wb") as f:
13
+ f.write(response.content)
14
+ st.markdown(
15
+ """
16
+ <style>
17
+ .stApp {
18
+ background-image: url('background.jpg');
19
+ background-size: cover;
20
+ }
21
+ </style>
22
+ """,
23
+ unsafe_allow_html=True
24
+ )
25
+ else:
26
+ st.error("Unable to load the background image.")
27
+
28
+ # Set background image
29
+ set_background_from_url(background_url)
30
 
31
  st.title("Image Editor")
32
 
33
  # Upload an image
34
+ uploaded_image = st.file_uploader("Add Image", type=["jpg", "jpeg", "png"])
35
 
36
  if uploaded_image:
37
  image = Image.open(uploaded_image)