|
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() |
|
|