File size: 1,272 Bytes
e299409
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import gradio as gr
import openai

def create_meeting_summary(openai_key, uploaded_audio):
    openai.api_key = openai_key
    transcript = openai.Audio.transcribe("whisper-1", open(uploaded_audio, "rb"))
    system_template = """会議の書き起こしが渡されます。

この会議のサマリーをMarkdown形式で作成してください。サマリーは、以下のような形式で書いてください。

- 会議の目的
- 会議の内容
- 会議の結果"""

    completion = openai.ChatCompletion.create(
        model="gpt-3.5-turbo",
        messages=[
            {"role": "system", "content": system_template},
            {"role": "user", "content": transcript.text}
        ]
    )
    response_text = completion.choices[0].message.content
    return response_text

inputs = [
    gr.Textbox(lines=1, label="openai_key"),
    gr.Audio(type="filepath", label="音声ファイルをアップロード")
]

outputs = gr.Textbox(label="会議サマリー")

app = gr.Interface(
    fn=create_meeting_summary,
    inputs=inputs,
    outputs=outputs,
    title="会議サマリー生成アプリ",
    description="音声ファイルをアップロードして、会議のサマリーをMarkdown形式で作成します。"
)

app.launch(debug=True)