Spaces:
Sleeping
Sleeping
File size: 729 Bytes
408242e ba0a843 545d6f0 ba0a843 545d6f0 ba0a843 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
import gradio as gr
from PIL import Image, ImageOps
def edit_image(image, grayscale, flip, rotate):
img = Image.open(image)
if grayscale:
img = ImageOps.grayscale(img)
if flip:
img = ImageOps.flip(img)
if rotate:
img = img.rotate(rotate)
return img
interface = gr.Interface(
fn=edit_image,
inputs=[
gr.Image(type="file", label="Upload Image"),
gr.Checkbox(label="Grayscale"),
gr.Checkbox(label="Flip Vertically"),
gr.Slider(minimum=0, maximum=360, step=1, default=0, label="Rotate Angle")
],
outputs=gr.Image(),
live=True,
title="Image Editor",
description="Upload an image and apply transformations"
)
interface.launch()
|