aiderd commited on
Commit
114332b
·
1 Parent(s): 20a9d0b

Delete app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -30
app.py DELETED
@@ -1,30 +0,0 @@
1
- import gradio as gr
2
- import openai
3
-
4
- # 设置OpenAI API凭据
5
- openai.api_key = "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"
6
- # 定义语音助手函数
7
- def voice_chatgpt(query):
8
-
9
- # 将用户的问题发送给ChatGPT进行回答
10
- response = openai.Completion.create(
11
- engine="text-davinci-003",
12
- prompt=query,
13
- max_tokens=1000,
14
- temperature=0.7,
15
- n=1,
16
- stop=None,
17
-
18
- )
19
- # 获取ChatGPT的回答
20
- answer = response.choices[0].text.strip()
21
-
22
- return answer
23
-
24
- # Build interface
25
- interface = gr.Interface(fn=voice_chatgpt,
26
- inputs="text",
27
- outputs="text")
28
-
29
- # Run app
30
- interface.launch()