File size: 1,615 Bytes
20f5c65 c082a07 20f5c65 c082a07 20f5c65 c082a07 20f5c65 c082a07 20f5c65 c082a07 20f5c65 c082a07 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Gradio-Lite: Serverless Gradio Running Entirely in Your Browser</title>
<meta name="description" content="Gradio-Lite: Serverless Gradio Running Entirely in Your Browser">
<script type="module" crossorigin src="https://cdn.jsdelivr.net/npm/@gradio/lite/dist/lite.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@gradio/lite/dist/lite.css" />
<style>
html, body {
margin: 0;
padding: 0;
height: 100%;
}
</style>
</head>
<body>
<gradio-lite>
<gradio-file name="app.py" entrypoint>
from transformers_js_py import import_transformers_js, read_audio
import gradio as gr
transformers = await import_transformers_js()
pipeline = transformers.pipeline
pipe = await pipeline('automatic-speech-recognition', 'Xenova/whisper-tiny.en')
async def asr(audio_path):
audio = read_audio(audio_path, 16000)
result = await pipe(audio)
return result["text"]
demo = gr.Interface(
asr,
gr.Audio(type="filepath"),
gr.Text(),
examples=[
["jfk.wav"],
]
)
demo.launch()
</gradio-file>
<gradio-file name="jfk.wav" url="https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/jfk.wav" />
<gradio-requirements>
transformers_js_py
numpy
scipy
</gradio-requirements>
</gradio-lite>
</body>
</html>
|