Spaces:
Runtime error
Runtime error
test
Browse files
app.py
CHANGED
@@ -10,9 +10,13 @@ def inference(task: str,
|
|
10 |
seq_len: int = 512,
|
11 |
topp: float = 0.9,
|
12 |
penalty_score: float = 1.0):
|
13 |
-
func = getattr(ernie_zeus, task)
|
14 |
-
return func(text, min_dec_len, seq_len, topp, penalty_score)
|
15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
|
17 |
title = "ERNIE-Zeus"
|
18 |
|
@@ -197,7 +201,7 @@ with block:
|
|
197 |
min_dec_len = gr.Slider(minimum=1, maximum=511, value=1, label="min_dec_len", step=1, interactive=True)
|
198 |
seq_len = gr.Slider(minimum=2, maximum=512, value=128, label="seq_len", step=1, interactive=True)
|
199 |
topp = gr.Slider(minimum=0.0, maximum=1.0, value=1.0, label="topp", step=0.01, interactive=True)
|
200 |
-
penalty_score = gr.Slider(minimum=1.0, maximum=2.0, value=1.0, label="
|
201 |
|
202 |
text_gen = gr.Text(label="generated_text")
|
203 |
|
|
|
10 |
seq_len: int = 512,
|
11 |
topp: float = 0.9,
|
12 |
penalty_score: float = 1.0):
|
|
|
|
|
13 |
|
14 |
+
func = getattr(ernie_zeus, task)
|
15 |
+
try:
|
16 |
+
result = func(text, min_dec_len, seq_len, topp, penalty_score)
|
17 |
+
return result
|
18 |
+
except Exception as error:
|
19 |
+
return str(error)
|
20 |
|
21 |
title = "ERNIE-Zeus"
|
22 |
|
|
|
201 |
min_dec_len = gr.Slider(minimum=1, maximum=511, value=1, label="min_dec_len", step=1, interactive=True)
|
202 |
seq_len = gr.Slider(minimum=2, maximum=512, value=128, label="seq_len", step=1, interactive=True)
|
203 |
topp = gr.Slider(minimum=0.0, maximum=1.0, value=1.0, label="topp", step=0.01, interactive=True)
|
204 |
+
penalty_score = gr.Slider(minimum=1.0, maximum=2.0, value=1.0, label="penalty_score", step=0.01, interactive=True)
|
205 |
|
206 |
text_gen = gr.Text(label="generated_text")
|
207 |
|