Spaces:
Running
Running
joseluhf11
commited on
Commit
•
0591d69
1
Parent(s):
1f0f03f
Update index.html
Browse files- index.html +49 -13
index.html
CHANGED
@@ -1,19 +1,55 @@
|
|
1 |
<!DOCTYPE html>
|
2 |
<html>
|
3 |
<head>
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
</head>
|
9 |
<body>
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
</html>
|
|
|
1 |
<!DOCTYPE html>
|
2 |
<html>
|
3 |
<head>
|
4 |
+
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto&display=swap" >
|
5 |
+
<style>
|
6 |
+
body {
|
7 |
+
font-family: 'Roboto', sans-serif;
|
8 |
+
font-size: 16px;
|
9 |
+
}
|
10 |
+
.logo {
|
11 |
+
height: 1em;
|
12 |
+
vertical-align: middle;
|
13 |
+
margin-bottom: 0.1em;
|
14 |
+
}
|
15 |
+
</style>
|
16 |
+
|
17 |
+
<script type="module" crossorigin src="https://cdn.jsdelivr.net/npm/@gradio/lite@0.4.2/dist/lite.js"></script>
|
18 |
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@gradio/lite@0.4.2/dist/lite.css" />
|
19 |
+
<link rel="stylesheet" href="https://gradio-hello-world.hf.space/theme.css">
|
20 |
</head>
|
21 |
<body>
|
22 |
+
<gradio-lite>
|
23 |
+
|
24 |
+
<gradio-requirements>
|
25 |
+
transformers_js_py
|
26 |
+
</gradio-requirements>
|
27 |
+
|
28 |
+
<gradio-file name="app.py" entrypoint>
|
29 |
+
from transformers_js import import_transformers_js
|
30 |
+
import gradio as gr
|
31 |
+
import numpy as np
|
32 |
+
|
33 |
+
transformers = await import_transformers_js()
|
34 |
+
pipeline = transformers.pipeline
|
35 |
+
pipe = await pipeline("automatic-speech-recognition",'Xenova/whisper-small')
|
36 |
+
|
37 |
+
async def transcribe(audio):
|
38 |
+
sr, y = audio
|
39 |
+
y = y.astype(np.float32)
|
40 |
+
y /= np.max(np.abs(y))
|
41 |
+
|
42 |
+
return pipe({"sampling_rate": sr, "raw": y})["text"]
|
43 |
+
|
44 |
+
demo = gr.Interface(
|
45 |
+
transcribe,
|
46 |
+
gr.Audio(source="microphone"),
|
47 |
+
"text",
|
48 |
+
theme=gr.themes.Soft(),)
|
49 |
+
|
50 |
+
demo.launch()
|
51 |
+
</gradio-file>
|
52 |
+
|
53 |
+
</gradio-lite>
|
54 |
+
</body>
|
55 |
</html>
|