jm12138 commited on
Commit
80492f0
1 Parent(s): 616db7f
Files changed (1) hide show
  1. app.py +10 -17
app.py CHANGED
@@ -1,8 +1,8 @@
1
- import matplotlib.pyplot as plt
2
  import gradio as gr
3
- import paddlehub as hub
4
 
5
- ernie_zeus = hub.Module(name='ernie_zeus')
6
 
7
 
8
  def inference(task: str,
@@ -14,9 +14,9 @@ def inference(task: str,
14
  return "success"
15
 
16
 
17
- title = "ERNIE-ViLG"
18
 
19
- description = "ERNIE-ViLG model, which supports text-to-image task."
20
 
21
  css = """
22
  .gradio-container {
@@ -134,12 +134,11 @@ with block:
134
  justify-content: center;
135
  ">
136
  <h1 style="font-weight: 900; margin-bottom: 7px;">
137
- ERNIE-ViLG Demo
138
  </h1>
139
  </div>
140
  <p style="margin-bottom: 10px; font-size: 94%">
141
- ERNIE-ViLG is a state-of-the-art text-to-image model that generates
142
- images from Chinese text.
143
  </p>
144
  </div>
145
  """
@@ -170,9 +169,9 @@ with block:
170
  topp = gr.Number(label="topp", value=1.0)
171
  penalty_score = gr.Number(label="penalty_score", value=1.0)
172
 
173
- text_gen = gr.Gallery(
174
- value=['images/%02d.jpg' % i for i in range(1, 7)], label="Generated images", show_label=False, elem_id="gallery"
175
- ).style(grid=[2, 3], height="auto")
176
 
177
  ex = gr.Examples(examples=examples, fn=inference, inputs=[
178
  text, task], outputs=text_gen, cache_examples=False)
@@ -182,12 +181,6 @@ with block:
182
  btn.click(inference, inputs=[text, task], outputs=text_gen)
183
  gr.HTML(
184
  """
185
- <div class="prompt">
186
- <p><h4>Prompt公式</h4>
187
- <span> Prompt = [形容词] [主语] ,[细节设定], [修饰语或者艺术家]。 </span>
188
- 关于各部分的构造方式和效果,可以参考<a href="https://github.com/PaddlePaddle/PaddleHub/tree/develop/modules/image/text_to_image/ernie_vilg#六-prompt-指南" style="text-decoration: underline;" target="_blank">YouPromptMe指南</a>。
189
- </p>
190
- </div>
191
  <div class="footer">
192
  <p>Model by <a href="https://github.com/PaddlePaddle/PaddleHub" style="text-decoration: underline;" target="_blank">PaddleHub</a> and <a href="https://wenxin.baidu.com" style="text-decoration: underline;" target="_blank">文心大模型</a> - Gradio Demo by 🤗 Hugging Face
193
  </p>
 
1
+ # import matplotlib.pyplot as plt
2
  import gradio as gr
3
+ # import paddlehub as hub
4
 
5
+ # ernie_zeus = hub.Module(name='ernie_zeus')
6
 
7
 
8
  def inference(task: str,
 
14
  return "success"
15
 
16
 
17
+ title = "ERNIE-Zeus"
18
 
19
+ description = "ERNIE-Zeus model, which supports Chinese text generates task."
20
 
21
  css = """
22
  .gradio-container {
 
134
  justify-content: center;
135
  ">
136
  <h1 style="font-weight: 900; margin-bottom: 7px;">
137
+ ERNIE-Zeus Demo
138
  </h1>
139
  </div>
140
  <p style="margin-bottom: 10px; font-size: 94%">
141
+ ERNIE-Zeus is a state-of-the-art Chinese text generates model.
 
142
  </p>
143
  </div>
144
  """
 
169
  topp = gr.Number(label="topp", value=1.0)
170
  penalty_score = gr.Number(label="penalty_score", value=1.0)
171
 
172
+ text_gen = gr.Text(
173
+ value='哈哈哈哈哈', label="Generated images", show_label=False
174
+ )
175
 
176
  ex = gr.Examples(examples=examples, fn=inference, inputs=[
177
  text, task], outputs=text_gen, cache_examples=False)
 
181
  btn.click(inference, inputs=[text, task], outputs=text_gen)
182
  gr.HTML(
183
  """
 
 
 
 
 
 
184
  <div class="footer">
185
  <p>Model by <a href="https://github.com/PaddlePaddle/PaddleHub" style="text-decoration: underline;" target="_blank">PaddleHub</a> and <a href="https://wenxin.baidu.com" style="text-decoration: underline;" target="_blank">文心大模型</a> - Gradio Demo by 🤗 Hugging Face
186
  </p>