File size: 464 Bytes
a90f4a6 d2f6a84 e2cda67 b7a4079 b9ec073 b7a4079 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
import tempfile
from pathlib import Path
from PIL import Image
import gradio as gr
def fake():
image = Image.new("RGB", (512, 512))
with tempfile.NamedTemporaryFile(suffix=".jpg", delete=False) as tmpfile:
image.save(tmpfile, "JPEG", quality=80, optimize=True, progressive=True)
return Path(tmpfile.name)
with gr.Blocks() as demo:
t = gr.Textbox()
i = gr.Image(type="filepath")
t.submit(fake, None, i)
demo.launch() |