Spaces:
Runtime error
Runtime error
import gradio as gr | |
# 加载模型 | |
model = gr.load("models/black-forest-labs/FLUX.1-dev") | |
# 定义更多的示例 | |
examples = [ | |
["A beautiful sunset over a calm ocean"], | |
["A futuristic cityscape with flying cars"], | |
["A serene forest scene with a babbling brook"], | |
["An abstract representation of love with swirling colors"], | |
["A cat playing with a ball of yarn in a cozy living room"], | |
["A majestic mountain range under a starry night sky"], | |
["A bustling farmer's market with colorful produce"], | |
["A steampunk-inspired clockwork mechanism"], | |
["A tranquil Japanese garden with a koi pond"], | |
["A whimsical treehouse in an enchanted forest"] | |
] | |
# 创建新的接口,添加示例 | |
demo = gr.Interface( | |
fn=model.predict, | |
inputs=model.input_components, | |
outputs=model.output_components, | |
examples=examples, | |
title="FLUX.1 [dev] Image Generation", | |
description="Enter a text prompt to generate an image using FLUX.1 [dev]." | |
) | |
# 启动应用 | |
demo.launch() |