chenjian commited on
Commit
9f6a8e3
1 Parent(s): f8fe65a

add ERNIE-ViLG module

Browse files
Files changed (3) hide show
  1. README.md +1 -1
  2. app.py +22 -0
  3. requirements.txt +2 -0
README.md CHANGED
@@ -1,5 +1,5 @@
1
  ---
2
- title: ERNIE ViLG
3
  emoji: 📉
4
  colorFrom: yellow
5
  colorTo: pink
 
1
  ---
2
+ title: ERNIE-ViLG
3
  emoji: 📉
4
  colorFrom: yellow
5
  colorTo: pink
app.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import gradio as gr
3
+ import paddlehub as hub
4
+
5
+
6
+ model = hub.Module(name='ernie_vilg')
7
+
8
+
9
+ def inference(text_prompts):
10
+ results = model.generate_image(
11
+ text_prompts=text_prompts)
12
+ return np.array(results[0])
13
+
14
+ outputs = [
15
+ gr.outputs.Image(type="numpy",label="result")
16
+ ]
17
+
18
+ title="ERNIE-ViLG"
19
+
20
+ description="ERNIE-ViLG model, which supports text-to-image task."
21
+
22
+ gr.Interface(inference, gr.inputs.Textbox(),outputs,title=title,description=description).launch(enable_queue=True)
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ paddlehub
2
+ requests