Spaces:
Runtime error
Runtime error
File size: 1,495 Bytes
5f99cc5 8c5c8af 5f99cc5 8c5c8af 0afff03 8c5c8af 0afff03 8c5c8af 0afff03 8d56d1d 8c5c8af 03e73dc 8c5c8af 03e73dc 8c5c8af 8d56d1d 8c5c8af 03e73dc |
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 34 35 |
import gradio as gr
from transformers import FlaxControlNetModel, FlaxStableDiffusionControlNetPipeline, AutoTokenizer
def load_model(model_name):
tokenizer = AutoTokenizer.from_pretrained(model_name)
controlnet = FlaxControlNetModel.from_pretrained(model_name)
pipeline = FlaxStableDiffusionControlNetPipeline.from_pretrained(model_name)
return tokenizer, controlnet, pipeline
model_name = "Ryukijano/controlnet-fill-circle"
tokenizer, controlnet, pipeline = load_model(model_name)
def infer_fill_circle(prompt, image):
# Your inference function for fill circle control
inputs = tokenizer(prompt, return_tensors="jax")
# Implement your image preprocessing here
outputs = pipeline.generate(inputs, image)
return outputs
with gr.Blocks(theme='gradio/soft') as demo:
gr.Markdown("## Stable Diffusion with Fill Circle Control")
gr.Markdown("In this app, you can find the ControlNet with Fill Circle control.")
with gr.Tab("ControlNet Fill Circle"):
prompt_input_fill_circle = gr.Textbox(label="Prompt")
negative_prompt_fill_circle = gr.Textbox(label="Negative Prompt")
fill_circle_input = gr.Image(label="Input Image")
fill_circle_output = gr.Image(label="Output Image")
submit_btn = gr.Button(value="Submit")
fill_circle_inputs = [prompt_input_fill_circle, fill_circle_input]
submit_btn.click(fn=infer_fill_circle, inputs=fill_circle_inputs, outputs=[fill_circle_output])
demo.launch()
|