Update app.py
Browse files
app.py
CHANGED
|
@@ -34,42 +34,9 @@ def gen_image(desc: str):
|
|
| 34 |
return [image]
|
| 35 |
|
| 36 |
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
'来自深渊 雪山飞狐'
|
| 44 |
-
]
|
| 45 |
-
|
| 46 |
-
block = gr.Blocks()
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
with block:
|
| 50 |
-
with gr.Group():
|
| 51 |
-
with gr.Box():
|
| 52 |
-
with gr.Row().style(mobile_collapse=False, equal_height=True):
|
| 53 |
-
text = gr.Textbox(
|
| 54 |
-
label="Desc",
|
| 55 |
-
show_label=False,
|
| 56 |
-
max_lines=1,
|
| 57 |
-
placeholder="输入中文,生成图片",
|
| 58 |
-
).style(
|
| 59 |
-
border=(True, False, True, True),
|
| 60 |
-
rounded=(True, False, False, True),
|
| 61 |
-
container=False,
|
| 62 |
-
)
|
| 63 |
-
|
| 64 |
-
btn = gr.Button("Generate image").style(
|
| 65 |
-
margin=False,
|
| 66 |
-
rounded=(False, True, True, False),
|
| 67 |
-
)
|
| 68 |
-
|
| 69 |
-
gallery = gr.Gallery(
|
| 70 |
-
label="Generated images", show_label=False, elem_id="gallery"
|
| 71 |
-
).style(grid=[1, 1], height="auto")
|
| 72 |
-
|
| 73 |
-
gr.Examples(examples=examples, fn=gen_image, inputs=text, outputs=gallery)
|
| 74 |
-
|
| 75 |
-
block.queue(concurrency_count=3).launch(debug=True)
|
|
|
|
| 34 |
return [image]
|
| 35 |
|
| 36 |
|
| 37 |
+
demo = gr.Interface(
|
| 38 |
+
fn=gen_image,
|
| 39 |
+
inputs=["text", "text"],
|
| 40 |
+
outputs=["image"],
|
| 41 |
+
)
|
| 42 |
+
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|