Spaces:
Runtime error
Runtime error
File size: 1,037 Bytes
5f99cc5 0afff03 5f99cc5 0afff03 03e73dc 0afff03 03e73dc 0afff03 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 36 |
import gradio as gr
from transformers import FlaxAutoModel, AutoTokenizer
def load_model_and_tokenizer(model_name):
model = FlaxAutoModel.from_pretrained(model_name)
tokenizer = AutoTokenizer.from_pretrained(model_name)
return model, tokenizer
def generate_image(model, tokenizer, prompt):
# Process the input prompt and generate the output image using the model and tokenizer
# ...
# output_image = ... (your implementation here)
return output_image
def infer(prompt):
model_name = "Ryukijano/controlnet-fill-circle"
model, tokenizer = load_model_and_tokenizer(model_name)
output_image = generate_image(model, tokenizer, prompt)
return output_image
iface = gr.Interface(
fn=infer,
inputs=["text"],
outputs="image",
title="ControlNet Fill Circle",
description="This is a demo of ControlNet Fill Circle.",
examples=[
["red circle with blue background"],
["cyan circle with brown floral background"]
],
theme="gradio/soft",
)
iface.launch()
|