Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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("
|
| 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)
|