Spaces:
Runtime error
Runtime error
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() | |