Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,16 +1,31 @@
|
|
| 1 |
-
import gradio as gr
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
]
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
|
| 3 |
+
# 加载模型
|
| 4 |
+
model = gr.load("models/black-forest-labs/FLUX.1-dev")
|
| 5 |
+
|
| 6 |
+
# 定义更多的示例
|
| 7 |
+
examples = [
|
| 8 |
+
["A beautiful sunset over a calm ocean"],
|
| 9 |
+
["A futuristic cityscape with flying cars"],
|
| 10 |
+
["A serene forest scene with a babbling brook"],
|
| 11 |
+
["An abstract representation of love with swirling colors"],
|
| 12 |
+
["A cat playing with a ball of yarn in a cozy living room"],
|
| 13 |
+
["A majestic mountain range under a starry night sky"],
|
| 14 |
+
["A bustling farmer's market with colorful produce"],
|
| 15 |
+
["A steampunk-inspired clockwork mechanism"],
|
| 16 |
+
["A tranquil Japanese garden with a koi pond"],
|
| 17 |
+
["A whimsical treehouse in an enchanted forest"]
|
| 18 |
+
]
|
| 19 |
+
|
| 20 |
+
# 创建新的接口,添加示例
|
| 21 |
+
demo = gr.Interface(
|
| 22 |
+
fn=model.predict,
|
| 23 |
+
inputs=model.input_components,
|
| 24 |
+
outputs=model.output_components,
|
| 25 |
+
examples=examples,
|
| 26 |
+
title="FLUX.1 [dev] Image Generation",
|
| 27 |
+
description="Enter a text prompt to generate an image using FLUX.1 [dev]."
|
| 28 |
+
)
|
| 29 |
+
|
| 30 |
+
# 启动应用
|
| 31 |
+
demo.launch()
|