|
import os |
|
import gradio as gr |
|
|
|
def update(slider, img): |
|
|
|
if not os.path.exists('temp'): |
|
os.system('mkdir temp') |
|
|
|
img.save("temp/image.jpg", "JPEG") |
|
|
|
return f'temp/image.jpg' |
|
|
|
with gr.Blocks() as demo: |
|
gr.Markdown("Start typing below and then click **Run** to see the output.") |
|
inp = [gr.Slider(1,15, default = 2, label='StepCycles',step= 1)] |
|
|
|
with gr.Row(): |
|
inp.append(gr.Image(type="pil", label="Input")) |
|
out = gr.Image(type="file", label="Output") |
|
btn = gr.Button("Run") |
|
btn.click(fn=update, inputs=inp, outputs=out) |
|
|
|
demo.launch() |