merve HF Staff commited on
Commit
cdcd05b
·
1 Parent(s): 4ab90bc

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -0
app.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from PIL import Image
3
+
4
+
5
+ def infer_segmentation(prompt, negative_prompt, image):
6
+ # implement your inference function here
7
+ im = Image.open("cat_image.jpeg")
8
+ return im
9
+
10
+ def infer_canny(prompt, negative_prompt, image):
11
+ # implement your inference function here
12
+ im = Image.open("cat_image.jpeg")
13
+ return im
14
+
15
+ with gr.Blocks() as demo:
16
+ gr.Markdown("## Stable Diffusion with Different Controls")
17
+ gr.Markdown("In this app, you can find different ControlNets with different filters. ")
18
+
19
+ input_list = [prompt_input, negative_prompt_input, image_input]
20
+ with gr.Tab("ControlNet on Canny Filter "):
21
+ prompt_input = gr.Textbox(label="Prompt")
22
+ negative_prompt_input = gr.Textbox(label="Negative Prompt")
23
+ image_input = gr.Image(label="Image")
24
+ submit_btn = gr.Button("Submit")
25
+ submit_btn.click(fn=write_to_dataset, inputs=input_list, outputs="image")
26
+ with gr.Tab("ControlNet with Semantic Segmentation"):
27
+ prompt_input = gr.Textbox(label="Prompt")
28
+ negative_prompt_input = gr.Textbox(label="Negative Prompt")
29
+ image_input = gr.Image(label="Image")
30
+ submit_btn = gr.Button("Submit")
31
+ submit_btn.click(fn=write_to_dataset, inputs=input_list, outputs="image")
32
+
33
+ demo.launch()