Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -46,10 +46,11 @@ def infer(selected_space, prompt, seed=42, randomize_seed=False, width=1024, hei
|
|
46 |
raise gr.Error(e)
|
47 |
return result
|
48 |
|
|
|
49 |
examples = [
|
50 |
-
"a tiny astronaut hatching from an egg on the moon",
|
51 |
-
"a cat holding a sign that says hello world",
|
52 |
-
"an anime illustration of a wiener schnitzel",
|
53 |
]
|
54 |
|
55 |
css = """
|
@@ -118,9 +119,9 @@ with gr.Blocks(css=css) as demo:
|
|
118 |
|
119 |
gr.Examples(
|
120 |
examples=examples,
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
cache_examples="lazy"
|
125 |
)
|
126 |
|
@@ -138,6 +139,7 @@ with gr.Blocks(css=css) as demo:
|
|
138 |
],
|
139 |
outputs=[result, seed]
|
140 |
)
|
|
|
141 |
"""
|
142 |
<div class="footer">
|
143 |
<p>
|
|
|
46 |
raise gr.Error(e)
|
47 |
return result
|
48 |
|
49 |
+
# 将示例格式化为正确的嵌套列表格式
|
50 |
examples = [
|
51 |
+
["a tiny astronaut hatching from an egg on the moon"],
|
52 |
+
["a cat holding a sign that says hello world"],
|
53 |
+
["an anime illustration of a wiener schnitzel"],
|
54 |
]
|
55 |
|
56 |
css = """
|
|
|
119 |
|
120 |
gr.Examples(
|
121 |
examples=examples,
|
122 |
+
inputs=prompt, # 只使用 prompt 作为输入
|
123 |
+
outputs=result, # 只使用 result 作为输出
|
124 |
+
fn=infer, # 使用 infer 函数
|
125 |
cache_examples="lazy"
|
126 |
)
|
127 |
|
|
|
139 |
],
|
140 |
outputs=[result, seed]
|
141 |
)
|
142 |
+
|
143 |
"""
|
144 |
<div class="footer">
|
145 |
<p>
|