Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,32 +1,5 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 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()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|