Spaces:
Runtime error
Runtime error
chenjian
commited on
Commit
·
1e4d0d3
1
Parent(s):
e20e3d3
international
Browse files
app.py
CHANGED
@@ -4,9 +4,10 @@ import paddlehub as hub
|
|
4 |
|
5 |
|
6 |
model = hub.Module(name='ernie_vilg')
|
7 |
-
|
8 |
-
def inference(text_prompts,
|
9 |
try:
|
|
|
10 |
results = model.generate_image(
|
11 |
text_prompts=text_prompts, style=style, visualization=False)
|
12 |
return 'Success', results[:6]
|
@@ -163,7 +164,7 @@ with block:
|
|
163 |
margin=False,
|
164 |
rounded=(False, True, True, False),
|
165 |
)
|
166 |
-
styles = gr.Dropdown(label="style(风格)", choices=['水彩','油画', '粉笔画', '卡通', '蜡笔画', '儿童画', '探索无限'], value='
|
167 |
gallery = gr.Gallery(
|
168 |
label="Generated images", show_label=False, elem_id="gallery"
|
169 |
).style(grid=[2, 3], height="auto")
|
|
|
4 |
|
5 |
|
6 |
model = hub.Module(name='ernie_vilg')
|
7 |
+
style_list = ['水彩','油画', '粉笔画', '卡通', '蜡笔画', '儿童画', '探索无限']
|
8 |
+
def inference(text_prompts, style_indx):
|
9 |
try:
|
10 |
+
style = style_list[style_indx]
|
11 |
results = model.generate_image(
|
12 |
text_prompts=text_prompts, style=style, visualization=False)
|
13 |
return 'Success', results[:6]
|
|
|
164 |
margin=False,
|
165 |
rounded=(False, True, True, False),
|
166 |
)
|
167 |
+
styles = gr.Dropdown(label="style(风格)", choices=['水彩(Watercolor)','油画(Oil painting)', '粉笔画(Chalk drawing)', '卡通(Cartoon)', '蜡笔画(Crayon drawing)', '儿童画(Children\'s drawing)', '探索无限(Explore infinity)'], value='探索无限(Explore infinity)', type="index")
|
168 |
gallery = gr.Gallery(
|
169 |
label="Generated images", show_label=False, elem_id="gallery"
|
170 |
).style(grid=[2, 3], height="auto")
|