Ofiroz91's picture
Update app.py
2612e90 verified
raw
history blame
726 Bytes
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()