joseluhf11 commited on
Commit
0591d69
1 Parent(s): 1f0f03f

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +49 -13
index.html CHANGED
@@ -1,19 +1,55 @@
1
  <!DOCTYPE html>
2
  <html>
3
  <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
 
 
 
 
 
 
 
 
 
 
 
 
8
  </head>
9
  <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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>