Update app.py
Browse files
app.py
CHANGED
|
@@ -3,6 +3,7 @@ from PIL import Image
|
|
| 3 |
import numpy as np
|
| 4 |
import io
|
| 5 |
import time
|
|
|
|
| 6 |
|
| 7 |
# Hugging Face Transformers specific imports
|
| 8 |
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
|
@@ -33,15 +34,25 @@ def main():
|
|
| 33 |
image = Image.open(uploaded_file)
|
| 34 |
st.image(image, caption="Uploaded Image", use_column_width=True)
|
| 35 |
|
| 36 |
-
#
|
| 37 |
-
st.write("Rotating image...")
|
| 38 |
rotation_angle = 0
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
while True:
|
| 40 |
-
|
| 41 |
-
st.image(rotated_image, caption="Rotated Image", use_column_width=True)
|
| 42 |
-
time.sleep(0.1) # Adjust rotation speed
|
| 43 |
rotation_angle += rotation_speed
|
| 44 |
rotation_angle %= 360 # Keep angle within 0-359 range
|
| 45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
if __name__ == "__main__":
|
| 47 |
main()
|
|
|
|
| 3 |
import numpy as np
|
| 4 |
import io
|
| 5 |
import time
|
| 6 |
+
import math
|
| 7 |
|
| 8 |
# Hugging Face Transformers specific imports
|
| 9 |
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
|
|
|
| 34 |
image = Image.open(uploaded_file)
|
| 35 |
st.image(image, caption="Uploaded Image", use_column_width=True)
|
| 36 |
|
| 37 |
+
# Rotation angle initialization
|
|
|
|
| 38 |
rotation_angle = 0
|
| 39 |
+
|
| 40 |
+
# Display an empty placeholder
|
| 41 |
+
rotating_image_placeholder = st.empty()
|
| 42 |
+
|
| 43 |
while True:
|
| 44 |
+
# Calculate the new rotation angle
|
|
|
|
|
|
|
| 45 |
rotation_angle += rotation_speed
|
| 46 |
rotation_angle %= 360 # Keep angle within 0-359 range
|
| 47 |
|
| 48 |
+
# Rotate the image
|
| 49 |
+
rotated_image = rotate_image(image, rotation_angle)
|
| 50 |
+
|
| 51 |
+
# Display the rotated image
|
| 52 |
+
rotating_image_placeholder.image(rotated_image, caption="Rotated Image", use_column_width=True)
|
| 53 |
+
|
| 54 |
+
# Pause briefly to control the rotation speed
|
| 55 |
+
time.sleep(0.1)
|
| 56 |
+
|
| 57 |
if __name__ == "__main__":
|
| 58 |
main()
|