Spaces:
Build error
Build error
File size: 844 Bytes
b165e98 5d863dd b165e98 5d863dd b165e98 5d863dd b165e98 5d863dd b165e98 5d863dd |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
import gradio as gr
import whisper
import base64
# Whisper ๋ชจ๋ธ ๋ก๋
model = whisper.load_model("base")
# ์์ฑ์ ํ
์คํธ๋ก ๋ณํํ๋ ํจ์
def transcribe_audio(audio):
result = model.transcribe(audio)
return result["text"], base64.b64encode(result["text"].encode()).decode() #type: ignore
# Gradio ์ธํฐํ์ด์ค
demo = gr.Interface(fn=transcribe_audio,
inputs=gr.Audio(label = '์ค๋์ค', sources="microphone", type="filepath"),
outputs=[gr.Textbox(label='๊ฒฐ๊ณผ'), gr.Textbox(label='์ํธํ๋ ๊ฒฐ๊ณผ')],
title='์ด์ฐ์ง์ Speech to Text',
description='AI 60%, ๋ 40% (AI ์ฝ๋ 40๋ถ๋์ ๊ณ ์น๋ค๊ฐ new chat์ผ๋ก ๋ค์ ์ง๋๊น ๋ฐ๋ก๋จ) (Interface๋ ๋ด๊ฐ๋ง๋ฌ) (์ ์์๊ฐ 1์๊ฐ)')
# ์ฑ ์คํ
demo.launch(share=True, auth=('๊ฒฝ์ง์จ๋ฐ', '123456'))
|