import gradio as gr title = "Character aware stable difusion" description = "This is a demo o a character aware diffusion model" def infer_sd(prompt, negative_prompt, image): # your inference function for stable diffusion control return None def infer_charr_sd(prompt, negative_prompt, image): # your inference function for charr stable difusion control return None with gr.Blocks(theme='gradio/soft') as demo: gr.Markdown("## Character aware stable difusion") with gr.Tab("Character-Aware Difusion "): prompt_input_charr = gr.Textbox(label="Prompt") negative_prompt_charr = gr.Textbox(label="Negative Prompt") charr_input = gr.Image(label="Input Image") charr_output = gr.Image(label="Output Image") submit_btn = gr.Button(value = "Submit") charr_inputs = [prompt_input_charr, negative_prompt_charr, charr_input] submit_btn.click(fn=infer_charr_sd, inputs=charr_inputs, outputs=[charr_output]) with gr.Tab("Stable Diffusion"): prompt_input_seg = gr.Textbox(label="Prompt") negative_prompt_seg = gr.Textbox(label="Negative Prompt") sd_input = gr.Image(label="Input Image") sd_output = gr.Image(label="Output Image") submit_btn = gr.Button(value = "Submit") sd_inputs = [prompt_input_seg, negative_prompt_seg, sd_input] submit_btn.click(fn=infer_sd, inputs=sd_inputs, outputs=[sd_output]) #examples = [["postage stamp from california", "low quality", "charr_output.png", "charr_output.png" ]] #gr.Examples(fn = infer_sd, inputs = ["text", "text", "image", "image"], examples=examples, cache_examples=True) demo.launch()