Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,19 +1,14 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
import
|
| 3 |
|
| 4 |
def resize_image(image):
|
| 5 |
new_width=360
|
| 6 |
new_height=image.height*new_width//image.width
|
| 7 |
resized_image = image.resize((new_width, new_height))
|
| 8 |
-
|
| 9 |
-
file_name = image.filename
|
| 10 |
-
file_name_without_extension, file_extension = os.path.splitext(file_name)
|
| 11 |
-
new_file_name = f"{file_name_without_extension}_360{file_extension}"
|
| 12 |
-
resized_image.save(new_file_name)
|
| 13 |
-
return new_file_name
|
| 14 |
|
| 15 |
iface = gr.Interface(fn=resize_image,
|
| 16 |
-
inputs=[gr.Image(type="pil"
|
| 17 |
outputs=gr.Image(type="pil", label="360width Image")
|
| 18 |
)
|
| 19 |
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from PIL import Image
|
| 3 |
|
| 4 |
def resize_image(image):
|
| 5 |
new_width=360
|
| 6 |
new_height=image.height*new_width//image.width
|
| 7 |
resized_image = image.resize((new_width, new_height))
|
| 8 |
+
return resized_image
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
iface = gr.Interface(fn=resize_image,
|
| 11 |
+
inputs=[gr.Image(type="pil")],
|
| 12 |
outputs=gr.Image(type="pil", label="360width Image")
|
| 13 |
)
|
| 14 |
|