whitphx HF staff commited on
Commit
c082a07
1 Parent(s): eb60822

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +21 -20
index.html CHANGED
@@ -20,38 +20,39 @@
20
  <body>
21
  <gradio-lite>
22
  <gradio-file name="app.py" entrypoint>
 
23
  import gradio as gr
24
 
25
- from filters import as_gray
26
 
27
- def process(input_image):
28
- output_image = as_gray(input_image)
29
- return output_image
 
 
 
 
 
 
30
 
31
  demo = gr.Interface(
32
- process,
33
- "image",
34
- "image",
35
- examples=["lion.jpg", "logo.png"],
 
 
36
  )
37
 
38
  demo.launch()
39
  </gradio-file>
40
 
41
- <gradio-file name="filters.py">
42
- from skimage.color import rgb2gray
43
-
44
- def as_gray(image):
45
- return rgb2gray(image)
46
- </gradio-file>
47
-
48
- <gradio-file name="lion.jpg" url="https://raw.githubusercontent.com/gradio-app/gradio/main/gradio/test_data/lion.jpg" />
49
- <gradio-file name="logo.png" url="https://raw.githubusercontent.com/gradio-app/gradio/main/guides/assets/logo.png" />
50
 
51
  <gradio-requirements>
52
- # Same syntax as requirements.txt
53
- scikit-image
 
54
  </gradio-requirements>
55
  </gradio-lite>
56
  </body>
57
- </html>
 
20
  <body>
21
  <gradio-lite>
22
  <gradio-file name="app.py" entrypoint>
23
+ from transformers_js_py import import_transformers_js, read_audio
24
  import gradio as gr
25
 
 
26
 
27
+ transformers = await import_transformers_js()
28
+ pipeline = transformers.pipeline
29
+ pipe = await pipeline('automatic-speech-recognition', 'Xenova/whisper-tiny.en')
30
+
31
+
32
+ async def asr(audio_path):
33
+ audio = read_audio(audio_path, 16000)
34
+ result = await pipe(audio)
35
+ return result["text"]
36
 
37
  demo = gr.Interface(
38
+ asr,
39
+ gr.Audio(type="filepath"),
40
+ gr.Text(),
41
+ examples=[
42
+ ["jfk.wav"],
43
+ ]
44
  )
45
 
46
  demo.launch()
47
  </gradio-file>
48
 
49
+ <gradio-file name="jfk.wav" url="https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/jfk.wav" />
 
 
 
 
 
 
 
 
50
 
51
  <gradio-requirements>
52
+ transformers_js_py
53
+ numpy
54
+ scipy
55
  </gradio-requirements>
56
  </gradio-lite>
57
  </body>
58
+ </html>