Update app.py
Browse files
app.py
CHANGED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import openai
|
3 |
+
|
4 |
+
def summarize_audio(audio_file):
|
5 |
+
transcript = transcribe_audio(audio_file)
|
6 |
+
summary = create_summary(transcript)
|
7 |
+
return summary
|
8 |
+
|
9 |
+
def transcribe_audio(audio_file):
|
10 |
+
return "ืชืืืื ืืืืืื"
|
11 |
+
|
12 |
+
def create_summary(transcript):
|
13 |
+
response = openai.Completion.create(
|
14 |
+
engine="text-davinci-003",
|
15 |
+
prompt=f"Please summarize the following text:\n\n{transcript}",
|
16 |
+
max_tokens=100
|
17 |
+
)
|
18 |
+
return response['choices'][0]['text'].strip()
|
19 |
+
|
20 |
+
interface = gr.Interface(
|
21 |
+
fn=summarize_audio,
|
22 |
+
inputs=gr.Audio(source="upload", type="file"),
|
23 |
+
outputs="text",
|
24 |
+
title="ืืืืจ ืืืืื ืืกืืืื"
|
25 |
+
)
|
26 |
+
|
27 |
+
if __name__ == "__main__":
|
28 |
+
interface.launch()
|