Nakano Masato commited on
Commit
e9f7465
1 Parent(s): 514ef5d

Initial commit

Browse files
Files changed (2) hide show
  1. app.py +41 -0
  2. requirements.txt +1 -0
app.py ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import openai
3
+
4
+
5
+ def create_meeting_summary(openai_key, uploaded_audio):
6
+ openai.api_key = openai_key
7
+ transcript = openai.Audio.transcribe("whisper-1", open(uploaded_audio, "rb"))
8
+ system_template = """会議の書き起こしが渡されます。
9
+
10
+ この会議のサマリーをMarkdown形式で作成してください。サマリーは、以下のような形式で書いてください。
11
+
12
+ - 会議の目的
13
+ - 会議の内容
14
+ - 会議の結果"""
15
+
16
+ completion = openai.ChatCompletion.create(
17
+ model="gpt-3.5-turbo",
18
+ messages=[
19
+ {"role": "system", "content": system_template},
20
+ {"role": "user", "content": transcript.text}
21
+ ]
22
+ )
23
+ response_text = completion.choices[0].message.content
24
+ return response_text
25
+
26
+ inputs = [
27
+ gr.Textbox(lines=1, label="openai_key"),
28
+ gr.Audio(type="filepath", label="音声ファイルをアップロード")
29
+ ]
30
+
31
+ outputs = gr.Textbox(label="会議サマリー")
32
+
33
+ app = gr.Interface(
34
+ fn=create_meeting_summary,
35
+ inputs=inputs,
36
+ outputs=outputs,
37
+ title="会議サマリー生成アプリ",
38
+ description="音声ファイルをアップロードして、会議のサマリーをMarkdown形式で作成します。"
39
+ )
40
+
41
+ app.launch(debug=True)
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ openai==0.27.2