Spaces:
Runtime error
Runtime error
test
Browse files
app.py
CHANGED
@@ -95,16 +95,39 @@ block = gr.Blocks(css=css)
|
|
95 |
|
96 |
examples = [
|
97 |
[
|
98 |
-
'
|
99 |
-
'
|
|
|
100 |
],
|
101 |
[
|
102 |
-
'
|
103 |
-
'
|
|
|
104 |
],
|
105 |
[
|
106 |
-
'
|
107 |
-
'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
],
|
109 |
]
|
110 |
|
@@ -147,8 +170,7 @@ with block:
|
|
147 |
with gr.Box():
|
148 |
with gr.Row().style(mobile_collapse=False, equal_height=True):
|
149 |
text = gr.Textbox(
|
150 |
-
|
151 |
-
label="Prompt (Chinese)",
|
152 |
show_label=False,
|
153 |
max_lines=1,
|
154 |
placeholder="Enter your Chinese prompt",
|
@@ -173,21 +195,18 @@ with block:
|
|
173 |
],
|
174 |
value='text_summarization')
|
175 |
|
176 |
-
min_dec_len = gr.
|
177 |
-
seq_len = gr.
|
178 |
-
topp = gr.
|
179 |
-
penalty_score = gr.
|
180 |
|
181 |
-
text_gen = gr.Text(
|
182 |
-
value='哈哈哈哈哈', label="Generated images", show_label=False
|
183 |
-
)
|
184 |
|
185 |
ex = gr.Examples(examples=examples, fn=inference, inputs=[
|
186 |
-
text,
|
187 |
-
ex.dataset.headers = [""]
|
188 |
|
189 |
-
text.submit(inference, inputs=[text,
|
190 |
-
btn.click(inference, inputs=[text,
|
191 |
gr.HTML(
|
192 |
"""
|
193 |
<div class="footer">
|
|
|
95 |
|
96 |
examples = [
|
97 |
[
|
98 |
+
'text_summarization',
|
99 |
+
'在芬兰、瑞典提交“入约”申请近一个月来,北约成员国内部尚未对此达成一致意见。与此同时,俄罗斯方面也多次对北约“第六轮扩张”发出警告。据北约官网显示,北约秘书长斯托尔滕贝格将于本月12日至13日出访瑞典和芬兰,并将分别与两国领导人进行会晤。',
|
100 |
+
4, 512, 0.0, 1.0
|
101 |
],
|
102 |
[
|
103 |
+
'copywriting_generation',
|
104 |
+
'芍药香氛的沐浴乳',
|
105 |
+
32, 512, 0.9, 1.2
|
106 |
],
|
107 |
[
|
108 |
+
'novel_continuation',
|
109 |
+
'昆仑山可以说是天下龙脉的根源,所有的山脉都可以看作是昆仑的分支。这些分出来的枝枝杈杈,都可以看作是一条条独立的龙脉。',
|
110 |
+
2, 512, 0.9, 1.2
|
111 |
+
],
|
112 |
+
[
|
113 |
+
'answer_generation',
|
114 |
+
'杜鹃花怎么养?',
|
115 |
+
2, 512, 0.9, 1.2
|
116 |
+
],
|
117 |
+
[
|
118 |
+
'couplet_continuation',
|
119 |
+
'天增岁月人增寿',
|
120 |
+
2, 512, 0.9, 1.0
|
121 |
+
],
|
122 |
+
[
|
123 |
+
'composition_generation',
|
124 |
+
'诚以养德,信以修身',
|
125 |
+
128, 512, 0.9, 1.2
|
126 |
+
],
|
127 |
+
[
|
128 |
+
'text_cloze',
|
129 |
+
'她有着一双[MASK]的眼眸。',
|
130 |
+
1, 512, 0.9, 1.0
|
131 |
],
|
132 |
]
|
133 |
|
|
|
170 |
with gr.Box():
|
171 |
with gr.Row().style(mobile_collapse=False, equal_height=True):
|
172 |
text = gr.Textbox(
|
173 |
+
label="input_text",
|
|
|
174 |
show_label=False,
|
175 |
max_lines=1,
|
176 |
placeholder="Enter your Chinese prompt",
|
|
|
195 |
],
|
196 |
value='text_summarization')
|
197 |
|
198 |
+
min_dec_len = gr.Slider(minimum=1, maximum=511, value=1, label="min_dec_len", step=1, interactive=True)
|
199 |
+
seq_len = gr.Slider(minimum=2, maximum=512, value=128, label="seq_len", step=1, interactive=True)
|
200 |
+
topp = gr.Slider(minimum=0.0, maximum=1.0, value=1.0, label="topp", step=0.01, interactive=True)
|
201 |
+
penalty_score = gr.Slider(minimum=1.0, maximum=2.0, value=1.0, label="topp", step=0.01, interactive=True)
|
202 |
|
203 |
+
text_gen = gr.Text(label="generated_text")
|
|
|
|
|
204 |
|
205 |
ex = gr.Examples(examples=examples, fn=inference, inputs=[
|
206 |
+
task, text, min_dec_len, seq_len, topp, penalty_score], outputs=text_gen, cache_examples=False)
|
|
|
207 |
|
208 |
+
text.submit(inference, inputs=[task, text, min_dec_len, seq_len, topp, penalty_score], outputs=text_gen)
|
209 |
+
btn.click(inference, inputs=[task, text, min_dec_len, seq_len, topp, penalty_score], outputs=text_gen)
|
210 |
gr.HTML(
|
211 |
"""
|
212 |
<div class="footer">
|