File size: 726 Bytes
2612e90 |
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 |
import gradio as gr
import openai
def summarize_audio(audio_file):
transcript = transcribe_audio(audio_file)
summary = create_summary(transcript)
return summary
def transcribe_audio(audio_file):
return "ืชืืืื ืืืืืื"
def create_summary(transcript):
response = openai.Completion.create(
engine="text-davinci-003",
prompt=f"Please summarize the following text:\n\n{transcript}",
max_tokens=100
)
return response['choices'][0]['text'].strip()
interface = gr.Interface(
fn=summarize_audio,
inputs=gr.Audio(source="upload", type="file"),
outputs="text",
title="ืืืืจ ืืืืื ืืกืืืื"
)
if __name__ == "__main__":
interface.launch()
|