Drbrain0620 commited on
Commit
eb7784f
ยท
verified ยท
1 Parent(s): 2baef5f

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +21 -21
main.py CHANGED
@@ -1,21 +1,21 @@
1
- import gradio as gr
2
- import whisper
3
- import base64
4
-
5
- # Whisper ๋ชจ๋ธ ๋กœ๋“œ
6
- model = whisper.load_model("base")
7
-
8
- # ์Œ์„ฑ์„ ํ…์ŠคํŠธ๋กœ ๋ณ€ํ™˜ํ•˜๋Š” ํ•จ์ˆ˜
9
- def transcribe_audio(audio):
10
- result = model.transcribe(audio)
11
- return result["text"], base64.b64encode(result["text"].encode()).decode() #type: ignore
12
-
13
- # Gradio ์ธํ„ฐํŽ˜์ด์Šค
14
- demo = gr.Interface(fn=transcribe_audio,
15
- inputs=gr.Audio(label = '์˜ค๋””์˜ค', sources="microphone", type="filepath"),
16
- outputs=[gr.Textbox(label='๊ฒฐ๊ณผ'), gr.Textbox(label='์•”ํ˜ธํ™”๋œ ๊ฒฐ๊ณผ')],
17
- title='์ด์šฐ์ง„์˜ Speech to Text',
18
- description='AI 60%, ๋‚˜ 40% (AI ์ฝ”๋“œ 40๋ถ„๋™์•ˆ ๊ณ ์น˜๋‹ค๊ฐ€ new chat์œผ๋กœ ๋‹ค์‹œ ์งœ๋‹ˆ๊นŒ ๋ฐ”๋กœ๋จ) (Interface๋Š” ๋‚ด๊ฐ€๋งŒ๋“ฌ) (์ œ์ž‘์‹œ๊ฐ„ 1์‹œ๊ฐ„)')
19
-
20
- # ์•ฑ ์‹คํ–‰
21
- demo.launch(share=True, auth=('๊ฒฝ์ง„์”จ๋ฐ˜', '123456'))
 
1
+ import gradio as gr
2
+ import whisper
3
+ import base64
4
+
5
+ # Whisper ๋ชจ๋ธ ๋กœ๋“œ
6
+ model = whisper.load("base")
7
+
8
+ # ์Œ์„ฑ์„ ํ…์ŠคํŠธ๋กœ ๋ณ€ํ™˜ํ•˜๋Š” ํ•จ์ˆ˜
9
+ def transcribe_audio(audio):
10
+ result = model.transcribe(audio)
11
+ return result["text"], base64.b64encode(result["text"].encode()).decode() #type: ignore
12
+
13
+ # Gradio ์ธํ„ฐํŽ˜์ด์Šค
14
+ demo = gr.Interface(fn=transcribe_audio,
15
+ inputs=gr.Audio(label = '์˜ค๋””์˜ค', sources="microphone", type="filepath"),
16
+ outputs=[gr.Textbox(label='๊ฒฐ๊ณผ'), gr.Textbox(label='์•”ํ˜ธํ™”๋œ ๊ฒฐ๊ณผ')],
17
+ title='์ด์šฐ์ง„์˜ Speech to Text',
18
+ description='AI 60%, ๋‚˜ 40% (AI ์ฝ”๋“œ 40๋ถ„๋™์•ˆ ๊ณ ์น˜๋‹ค๊ฐ€ new chat์œผ๋กœ ๋‹ค์‹œ ์งœ๋‹ˆ๊นŒ ๋ฐ”๋กœ๋จ) (Interface๋Š” ๋‚ด๊ฐ€๋งŒ๋“ฌ) (์ œ์ž‘์‹œ๊ฐ„ 1์‹œ๊ฐ„)')
19
+
20
+ # ์•ฑ ์‹คํ–‰
21
+ demo.launch(share=True, auth=('๊ฒฝ์ง„์”จ๋ฐ˜', '123456'))