Spaces:
Runtime error
Runtime error
Merge branch 'main' of https://huggingface.co/spaces/PaddlePaddle/ERNIE-ViLG into main
Browse files
README.md
CHANGED
@@ -4,7 +4,7 @@ emoji: 🐼
|
|
4 |
colorFrom: yellow
|
5 |
colorTo: pink
|
6 |
sdk: gradio
|
7 |
-
sdk_version: 3.
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
license: apache-2.0
|
|
|
4 |
colorFrom: yellow
|
5 |
colorTo: pink
|
6 |
sdk: gradio
|
7 |
+
sdk_version: 3.2
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
license: apache-2.0
|
app.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import numpy as np
|
2 |
import gradio as gr
|
3 |
import paddlehub as hub
|
|
|
4 |
|
5 |
|
6 |
model = hub.Module(name='ernie_vilg')
|
@@ -9,6 +10,7 @@ language_model = hub.Module(name='baidu_translate')
|
|
9 |
style_list = ['水彩','油画', '粉笔画', '卡通', '蜡笔画', '儿童画', '探索无限']
|
10 |
language_list = ['zh', 'en', 'jp', 'kor']
|
11 |
def inference(text_prompts, language_indx, style_indx):
|
|
|
12 |
try:
|
13 |
style = style_list[style_indx]
|
14 |
if language_indx != 0:
|
@@ -16,9 +18,11 @@ def inference(text_prompts, language_indx, style_indx):
|
|
16 |
text_prompts = language_model.translate(text_prompts, language, 'zh')
|
17 |
results = model.generate_image(
|
18 |
text_prompts=text_prompts, style=style, visualization=False)
|
|
|
19 |
return 'Success', results[:6]
|
20 |
except Exception as e:
|
21 |
error_text = str(e)
|
|
|
22 |
return error_text, None
|
23 |
return
|
24 |
|
@@ -665,4 +669,4 @@ In "Explore infinity" style mode, how the image looks like is totally up to your
|
|
665 |
</div>
|
666 |
''')
|
667 |
|
668 |
-
block.queue(concurrency_count=
|
|
|
1 |
import numpy as np
|
2 |
import gradio as gr
|
3 |
import paddlehub as hub
|
4 |
+
import datetime
|
5 |
|
6 |
|
7 |
model = hub.Module(name='ernie_vilg')
|
|
|
10 |
style_list = ['水彩','油画', '粉笔画', '卡通', '蜡笔画', '儿童画', '探索无限']
|
11 |
language_list = ['zh', 'en', 'jp', 'kor']
|
12 |
def inference(text_prompts, language_indx, style_indx):
|
13 |
+
print(datetime.datetime.now())
|
14 |
try:
|
15 |
style = style_list[style_indx]
|
16 |
if language_indx != 0:
|
|
|
18 |
text_prompts = language_model.translate(text_prompts, language, 'zh')
|
19 |
results = model.generate_image(
|
20 |
text_prompts=text_prompts, style=style, visualization=False)
|
21 |
+
print(datetime.datetime.now())
|
22 |
return 'Success', results[:6]
|
23 |
except Exception as e:
|
24 |
error_text = str(e)
|
25 |
+
print(datetime.datetime.now())
|
26 |
return error_text, None
|
27 |
return
|
28 |
|
|
|
669 |
</div>
|
670 |
''')
|
671 |
|
672 |
+
block.queue(concurrency_count=80).launch()
|