TeamHaltmannSusanaHWCEO commited on
Commit
e1f9bab
·
1 Parent(s): 44749c0
Files changed (1) hide show
  1. app.py +43 -0
app.py ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from PIL import Image
3
+
4
+ # Load the image
5
+ @st.cache
6
+ def load_image(image):
7
+ return Image.open(image)
8
+
9
+ # Edit the image
10
+ @st.cache
11
+ def edit_image(image, width, height, rotate, blur):
12
+ # Resize the image
13
+ image = image.resize((width, height))
14
+
15
+ # Rotate the image
16
+ image = image.rotate(rotate)
17
+
18
+ # Blur the image
19
+ image = image.filter(ImageFilter.BLUR)
20
+
21
+ return image
22
+
23
+ # Create the main app
24
+ def main():
25
+ st.title("Photo Editor")
26
+
27
+ # Select the image to edit
28
+ image_file = st.file_uploader("Upload an image", type="jpg")
29
+ if image_file is not None:
30
+ image = load_image(image_file)
31
+ st.image(image, caption="Original Image")
32
+
33
+ # Edit the image
34
+ width = st.slider("Width", min_value=100, max_value=1000, value=400, step=100)
35
+ height = st.slider("Height", min_value=100, max_value=1000, value=400, step=100)
36
+ rotate = st.slider("Rotate", min_value=-180, max_value=180, value=0, step=10)
37
+ blur = st.checkbox("Blur")
38
+
39
+ edited_image = edit_image(image, width, height, rotate, blur)
40
+ st.image(edited_image, caption="Edited Image")
41
+
42
+ if __name__ == "__main__":
43
+ main()