issacneedsbread
commited on
Commit
•
dd26657
1
Parent(s):
65a71c7
init!
Browse files
app.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
import streamlit as st
|
2 |
-
from PIL import Image
|
3 |
import numpy as np
|
4 |
import io
|
5 |
import time
|
@@ -17,7 +17,10 @@ def rotate_image(image, angle):
|
|
17 |
"""
|
18 |
Rotate the given PIL image by the given angle
|
19 |
"""
|
20 |
-
|
|
|
|
|
|
|
21 |
|
22 |
def main():
|
23 |
st.title("Hugging Face Streamlit Example: Rotating Image")
|
|
|
1 |
import streamlit as st
|
2 |
+
from PIL import Image, ImageOps
|
3 |
import numpy as np
|
4 |
import io
|
5 |
import time
|
|
|
17 |
"""
|
18 |
Rotate the given PIL image by the given angle
|
19 |
"""
|
20 |
+
# Add padding to prevent cropping
|
21 |
+
image = ImageOps.expand(image, border=int(np.ceil(max(image.size) * 1.5)), fill="white")
|
22 |
+
rotated_image = image.rotate(angle, resample=Image.BICUBIC, expand=True)
|
23 |
+
return rotated_image
|
24 |
|
25 |
def main():
|
26 |
st.title("Hugging Face Streamlit Example: Rotating Image")
|