fun / app.py
heisenberg3376's picture
Update app.py
33bf146 verified
raw
history blame contribute delete
576 Bytes
import gradio as gr
import numpy as np
from PIL import Image
def save_sketch(image):
if image is None:
return "No image drawn!"
# Convert numpy array to PIL Image and save
img = Image.fromarray(image.astype("uint8"))
img.save("sketch.png")
return "Sketch saved successfully!"
# Create Gradio Sketchpad (no `shape` argument needed)
iface = gr.Interface(
fn=save_sketch,
inputs=gr.Sketchpad(),
outputs="text",
title="Basic Drawing Canvas",
description="Draw something and click submit to save the image."
)
iface.launch()