File size: 1,289 Bytes
cdcd05b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import gradio as gr
from PIL import Image


def infer_segmentation(prompt, negative_prompt, image):
    # implement your inference function here
    im = Image.open("cat_image.jpeg")
    return im

def infer_canny(prompt, negative_prompt, image):
    # implement your inference function here
    im = Image.open("cat_image.jpeg")
    return im

with gr.Blocks() as demo:
    gr.Markdown("## Stable Diffusion with Different Controls")
    gr.Markdown("In this app, you can find different ControlNets with different filters. ")

    input_list = [prompt_input, negative_prompt_input, image_input]
    with gr.Tab("ControlNet on Canny Filter "):
        prompt_input = gr.Textbox(label="Prompt")
        negative_prompt_input = gr.Textbox(label="Negative Prompt")
        image_input = gr.Image(label="Image")
        submit_btn = gr.Button("Submit")
        submit_btn.click(fn=write_to_dataset, inputs=input_list, outputs="image")
    with gr.Tab("ControlNet with Semantic Segmentation"):
        prompt_input = gr.Textbox(label="Prompt")
        negative_prompt_input = gr.Textbox(label="Negative Prompt")
        image_input = gr.Image(label="Image")
        submit_btn = gr.Button("Submit")
        submit_btn.click(fn=write_to_dataset, inputs=input_list, outputs="image")

demo.launch()