muqeet1234 commited on
Commit
7b6ed39
·
verified ·
1 Parent(s): 1583968

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -22
app.py CHANGED
@@ -3,10 +3,11 @@ from PIL import Image, ImageEnhance
3
  import io
4
  import requests
5
 
6
- # Corrected background URL
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:
@@ -52,24 +53,4 @@ if uploaded_image:
52
 
53
  # Apply filters
54
  enhancer_brightness = ImageEnhance.Brightness(image)
55
- image = enhancer_brightness.enhance(brightness)
56
-
57
- enhancer_contrast = ImageEnhance.Contrast(image)
58
- image = enhancer_contrast.enhance(contrast)
59
-
60
- enhancer_sharpness = ImageEnhance.Sharpness(image)
61
- image = enhancer_sharpness.enhance(sharpness)
62
-
63
- # Resize image
64
- image = image.resize((int(width), int(height)))
65
-
66
- # Display edited image
67
- st.image(image, caption="Edited Image", use_column_width=True)
68
-
69
- # Convert to bytes for download
70
- img_bytes = io.BytesIO()
71
- image.save(img_bytes, format="PNG")
72
- img_bytes = img_bytes.getvalue()
73
-
74
- # Download button
75
- st.download_button("Download Image", data=img_bytes, file_name="edited_image.png", mime="image/png")
 
3
  import io
4
  import requests
5
 
6
+ # Background Image URL (Corrected for direct download)
7
  background_url = "https://drive.google.com/uc?id=1I9IbcLTS2FIsWfAa1A5XA-2NdrMIuy-t"
8
 
9
  def set_background_from_url(url):
10
+ """Set the background image of the app using a URL."""
11
  response = requests.get(url)
12
  if response.status_code == 200:
13
  with open("background.jpg", "wb") as f:
 
53
 
54
  # Apply filters
55
  enhancer_brightness = ImageEnhance.Brightness(image)
56
+ image = enhancer_brightness.en