junzhaosun commited on
Commit
3bb42a7
1 Parent(s): 6e4a518

Add application file

Browse files
app.py ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/local/bin/python3
2
+ #-*- coding:utf-8 -*-
3
+ import gradio as gr
4
+
5
+ title = "OpenAI Whisper Large v2"
6
+
7
+ description = """
8
+ 本例用于演示 <b>openai/whisper-large-v2</b> 模型的语音识别(ASR)能力。目前没有对模型做微调,基于原始模型开发。 Whisper原始模型主要支持英语语音的识别。英语的效果最好,中文语音识别后只会输出汉语拼音。
9
+
10
+ <b>更多的信息请参考:</b> <a href="https://huggingface.co/openai/whisper-large-v2">openai/whisper-large-v2</a>。
11
+
12
+ <b>使用方法:</b> 上传一个音频文件或直接在页面中录制音频。音频会在传递到模型之前转换为单声道并重新采样为16 kHz。
13
+ """
14
+
15
+ article = """
16
+ <div style='margin:20px auto;'>
17
+
18
+ <p>
19
+ 参考:
20
+ <a href="https://huggingface.co/openai/whisper-large-v2">OpenAI Whisper Large v2</a> |
21
+ <a href="https://github.com/innev">Innev GitHub</a>
22
+ </p>
23
+
24
+ <p>音频案例:<p>
25
+ <ul>
26
+ <li>"春日阳光普照大地,正是踏春好时节" 来源: 知琪(Zhiqi)
27
+ <li>"Hmm, I don't know" 来源: <a href="https://freesound.org/people/InspectorJ/sounds/519189/">InspectorJ</a> (CC BY 4.0 license)
28
+ <li>"Henry V" excerpt 来源: <a href="https://freesound.org/people/acclivity/sounds/24096/">acclivity</a> (CC BY-NC 4.0 license)
29
+ <li>"You can see it in the eyes" 来源: <a href="https://freesound.org/people/JoyOhJoy/sounds/165348/">JoyOhJoy</a> (CC0 license)
30
+ <li>"We yearn for time" 来源: <a href="https://freesound.org/people/Sample_Me/sounds/610529/">Sample_Me</a> (CC0 license)
31
+ </ul>
32
+ </div>
33
+ """
34
+
35
+ examples = [
36
+ ["examples/zhiqi.wav", None],
37
+ ["examples/hmm_i_dont_know.wav", None],
38
+ ["examples/henry5.mp3", None],
39
+ ["examples/yearn_for_time.mp3", None],
40
+ ["examples/see_in_eyes.wav", None],
41
+ ]
42
+
43
+ gr.load(
44
+ "models/openai/whisper-large-v2",
45
+ inputs=[
46
+ gr.Audio(label="上传语音", source="upload", type="numpy"),
47
+ gr.Audio(label="录制语音", source="microphone", type="numpy"),
48
+ ],
49
+ outputs=gr.Text(label="识别出的文字"),
50
+ title=title,
51
+ description=description,
52
+ article=article,
53
+ examples=examples
54
+ ).launch()
examples/henry5.mp3 ADDED
Binary file (375 kB). View file
 
examples/hmm_i_dont_know.wav ADDED
Binary file (203 kB). View file
 
examples/see_in_eyes.wav ADDED
Binary file (65.2 kB). View file
 
examples/yearn_for_time.mp3 ADDED
Binary file (56.3 kB). View file
 
examples/zhiqi.wav ADDED
Binary file (322 kB). View file
 
packages.txt ADDED
File without changes
requirements.txt ADDED
File without changes