Vanyadoing commited on
Commit
dd6bf46
·
verified ·
1 Parent(s): 5c556c9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -31
app.py CHANGED
@@ -1,32 +1,5 @@
1
  import gradio as gr
2
- from PIL import Image
3
-
4
- def grayscale_pipeline(prompt): # keep signature the same at first!
5
- # ignore prompt; just use a demo image or make a blank
6
- img = Image.new('RGB', (256, 256), color='white')
7
- gray = img.convert("L")
8
- return gray, 42 # image, seed
9
-
10
- with gr.Blocks() as demo:
11
- with gr.Column():
12
- gr.Markdown(" # Grayscale Test Template")
13
-
14
- with gr.Row():
15
- prompt = gr.Text(label="Prompt")
16
- run_button = gr.Button("Run")
17
-
18
- result = gr.Image(label="Result")
19
-
20
- gr.Examples(examples=["any"], inputs=[prompt])
21
-
22
- gr.on(
23
- triggers=[run_button.click, prompt.submit],
24
- fn=grayscale_pipeline,
25
- inputs=[prompt],
26
- outputs=[result, gr.Number(label="Seed")], # keep outputs shape
27
- )
28
-
29
- if __name__ == "__main__":
30
- demo.launch()
31
-
32
-
 
1
  import gradio as gr
2
+ def invert(img):
3
+ return 255 - img
4
+ iface = gr.Interface(fn=invert, inputs=gr.Image(type="numpy"), outputs=gr.Image())
5
+ iface.launch()