File size: 422 Bytes
b7a4079
e2cda67
 
 
 
 
 
 
 
b7a4079
 
 
 
b9ec073
b7a4079
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import gradio as gr
from PIL import Image

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()