Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -5,7 +5,7 @@ import gradio as gr
|
|
5 |
openai.api_key = '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'
|
6 |
|
7 |
supportLanguages = [
|
8 |
-
["
|
9 |
["粤语", "yue"],
|
10 |
["古文", "wyw"],
|
11 |
["af","Afrikaans"],
|
@@ -233,21 +233,21 @@ with gr.Blocks(css=css) as demo:
|
|
233 |
state = gr.State([])
|
234 |
|
235 |
with gr.Column(elem_id="col-container"):
|
236 |
-
gr.Markdown("""##
|
237 |
-
|
238 |
|
239 |
with gr.Row():
|
240 |
with gr.Column():
|
241 |
-
translateFrom = gr.Dropdown(label="
|
242 |
input_message = gr.Textbox(max_lines=100, show_label=False, lines=10, placeholder="Enter text and press enter", visible=True).style(container=False)
|
243 |
with gr.Column():
|
244 |
-
translateTo = gr.Dropdown(label="
|
245 |
output = gr.Textbox(max_lines=100, show_label=False, lines=10, label="Output", visible=True).style(container=False)
|
246 |
|
247 |
-
btn_submit = gr.Button("
|
248 |
|
249 |
with gr.Row():
|
250 |
-
user_token = gr.Textbox(value='', placeholder="OpenAI API Key", type="password", label="
|
251 |
|
252 |
btn_submit.click(submit_message, [translateFrom, translateTo, user_token, input_message], [output])
|
253 |
|
|
|
5 |
openai.api_key = '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'
|
6 |
|
7 |
supportLanguages = [
|
8 |
+
["自动识别", "auto"],
|
9 |
["粤语", "yue"],
|
10 |
["古文", "wyw"],
|
11 |
["af","Afrikaans"],
|
|
|
233 |
state = gr.State([])
|
234 |
|
235 |
with gr.Column(elem_id="col-container"):
|
236 |
+
gr.Markdown("""## 翻译利器
|
237 |
+
使用OpenAI官方 API (gpt-3.5-turbo model).""", elem_id="header")
|
238 |
|
239 |
with gr.Row():
|
240 |
with gr.Column():
|
241 |
+
translateFrom = gr.Dropdown(label="原文", elem_id="translate-from", multiselect=False, value="auto", choices=[l[1] for l in supportLanguages]).style(container=False)
|
242 |
input_message = gr.Textbox(max_lines=100, show_label=False, lines=10, placeholder="Enter text and press enter", visible=True).style(container=False)
|
243 |
with gr.Column():
|
244 |
+
translateTo = gr.Dropdown(label="译文", elem_id="translate-to", multiselect=False, value="Chinese (Simplified)", choices=[l[1] for l in supportLanguages[1:]]).style(container=False)
|
245 |
output = gr.Textbox(max_lines=100, show_label=False, lines=10, label="Output", visible=True).style(container=False)
|
246 |
|
247 |
+
btn_submit = gr.Button("急急如律令")
|
248 |
|
249 |
with gr.Row():
|
250 |
+
user_token = gr.Textbox(value='', placeholder="OpenAI API Key", type="password", label="输入你自己的OpenAI API Key翻译过程会更准确哦~.")
|
251 |
|
252 |
btn_submit.click(submit_message, [translateFrom, translateTo, user_token, input_message], [output])
|
253 |
|