Ofiroz91 commited on
Commit
2612e90
โ€ข
1 Parent(s): f34fa0d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -0
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()