BOBOBO-Coder commited on
Commit
dff9a0f
·
verified ·
1 Parent(s): 3a09645

Delete app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -26
app.py DELETED
@@ -1,26 +0,0 @@
1
- import gradio as gr
2
- from openai import OpenAI
3
-
4
-
5
- with gr.Blocks() as demo:
6
- with gr.Column():
7
- gr.HTML("<h1>hello</h1>")
8
- gr.HTML("<h3>who r u?</h3>")
9
- inbox = gr.Textbox(label="输入中文")
10
- btn = gr.Button()
11
- outbox = gr.Textbox(label="输出语句")
12
- def fn(text):
13
- client = OpenAI(api_key = 'sk-svcacct-D_doQ9x98ixnbQa2AR86F-bEqlqoid101TOcoLT9duKdT3BlbkFJYpCHkFdlLhP9k-vegZwDmBaskTN0joQ34rdOGmx93BEA')
14
- messages = [{"role": "system",
15
- "content": "你是一个英语母语者,擅长将中文内容翻译成英语,也熟悉宝可梦这样动漫的一些人物名称,接下来我给出一段中文文本,你将直接进行翻译输出英文"}]
16
- messages.append({"role": "user", "content": text})
17
- response = client.chat.completions.create(model="gpt-4o", messages=messages)
18
- raise gr.Warning("1111")
19
- return response.choices[0].message.content
20
- btn.click(fn,inbox,outbox)
21
-
22
-
23
-
24
-
25
- if __name__ == "__main__":
26
- demo.launch()