Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -231,17 +231,18 @@ def analyze_letter(chinese_text: str):
|
|
| 231 |
fig_radar.tight_layout()
|
| 232 |
|
| 233 |
return (
|
| 234 |
-
translated, #
|
| 235 |
-
polite_version, #
|
| 236 |
-
zh_stats,
|
| 237 |
-
en_stats,
|
| 238 |
-
level,
|
| 239 |
-
|
| 240 |
-
fig_bar,
|
| 241 |
-
fig_radar
|
| 242 |
)
|
| 243 |
|
| 244 |
|
|
|
|
| 245 |
# ---------- 6. Gradio 界面 ----------
|
| 246 |
|
| 247 |
with gr.Blocks(title="Power Distance Checker") as demo:
|
|
@@ -256,6 +257,7 @@ with gr.Blocks(title="Power Distance Checker") as demo:
|
|
| 256 |
"""
|
| 257 |
)
|
| 258 |
|
|
|
|
| 259 |
with gr.Row():
|
| 260 |
input_box = gr.Textbox(label="输入中文信件", lines=6, placeholder="例如:您好,我想向您反馈近期的项目进度,如有不妥之处,还请您多多指正。")
|
| 261 |
|
|
@@ -277,10 +279,21 @@ with gr.Blocks(title="Power Distance Checker") as demo:
|
|
| 277 |
radar_plot = gr.Plot(label="Radar Chart:Stylistic Profile")
|
| 278 |
|
| 279 |
run_btn.click(
|
| 280 |
-
|
| 281 |
-
|
| 282 |
-
|
| 283 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 284 |
|
| 285 |
if __name__ == "__main__":
|
| 286 |
demo.launch()
|
|
|
|
| 231 |
fig_radar.tight_layout()
|
| 232 |
|
| 233 |
return (
|
| 234 |
+
translated, # 1
|
| 235 |
+
polite_version, # 2
|
| 236 |
+
zh_stats, # 3
|
| 237 |
+
en_stats, # 4
|
| 238 |
+
level, # 5
|
| 239 |
+
score, # 6
|
| 240 |
+
fig_bar, # 7
|
| 241 |
+
fig_radar # 8
|
| 242 |
)
|
| 243 |
|
| 244 |
|
| 245 |
+
|
| 246 |
# ---------- 6. Gradio 界面 ----------
|
| 247 |
|
| 248 |
with gr.Blocks(title="Power Distance Checker") as demo:
|
|
|
|
| 257 |
"""
|
| 258 |
)
|
| 259 |
|
| 260 |
+
|
| 261 |
with gr.Row():
|
| 262 |
input_box = gr.Textbox(label="输入中文信件", lines=6, placeholder="例如:您好,我想向您反馈近期的项目进度,如有不妥之处,还请您多多指正。")
|
| 263 |
|
|
|
|
| 279 |
radar_plot = gr.Plot(label="Radar Chart:Stylistic Profile")
|
| 280 |
|
| 281 |
run_btn.click(
|
| 282 |
+
fn=analyze_letter,
|
| 283 |
+
inputs=[input_box],
|
| 284 |
+
outputs=[
|
| 285 |
+
output_en, # 1 原始英译
|
| 286 |
+
polite_output = gr.Textbox(label="更礼貌的(增强版)英文", lines=6)
|
| 287 |
+
polite_output, # 2 更礼貌英译 --- 新增这个!
|
| 288 |
+
zh_json, # 3
|
| 289 |
+
en_json, # 4
|
| 290 |
+
pd_label, # 5
|
| 291 |
+
pd_score, # 6
|
| 292 |
+
bar_plot, # 7
|
| 293 |
+
radar_plot # 8
|
| 294 |
+
]
|
| 295 |
+
)
|
| 296 |
+
|
| 297 |
|
| 298 |
if __name__ == "__main__":
|
| 299 |
demo.launch()
|