Spaces:
Runtime error
Runtime error
chenjian
commited on
Commit
•
d0aa280
1
Parent(s):
b08d342
add module files
Browse files- app.py +16 -0
- requirements.txt +3 -0
app.py
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import paddlehub as hub
|
3 |
+
|
4 |
+
|
5 |
+
transformer_zh = hub.Module(name="transformer_zh-en")
|
6 |
+
|
7 |
+
def inference(text):
|
8 |
+
results = transformer_zh.predict(data=[text])
|
9 |
+
return results[0]
|
10 |
+
|
11 |
+
|
12 |
+
title="transformer_zh-en"
|
13 |
+
description="Transformer model used for translating Chinese into English."
|
14 |
+
|
15 |
+
examples=[['今天是个好日子']]
|
16 |
+
gr.Interface(inference,"text",[gr.outputs.Textbox(label="Translation")],title=title,description=description,examples=examples).launch(enable_queue=True)
|
requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
paddlepaddle
|
2 |
+
paddlehub
|
3 |
+
|