Spaces:
Build error
Build error
Upload folder using huggingface_hub
Browse files- README.md +2 -8
- main.py +16 -0
- requirements.txt +5 -0
README.md
CHANGED
|
@@ -1,12 +1,6 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
|
| 4 |
-
colorFrom: blue
|
| 5 |
-
colorTo: blue
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: 5.21.0
|
| 8 |
-
app_file: app.py
|
| 9 |
-
pinned: false
|
| 10 |
---
|
| 11 |
-
|
| 12 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
+
title: transcript_and_translate
|
| 3 |
+
app_file: main.py
|
|
|
|
|
|
|
| 4 |
sdk: gradio
|
| 5 |
sdk_version: 5.21.0
|
|
|
|
|
|
|
| 6 |
---
|
|
|
|
|
|
main.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
whisper = pipeline("automatic-speech-recognition", model="openai/whisper-small")
|
| 6 |
+
trans_en_ko = pipeline("translation", model="Helsinki-NLP/opus-mt-en-ko")
|
| 7 |
+
trans_ko_en = pipeline("translation", model="Helsinki-NLP/opus-mt-ko-en")
|
| 8 |
+
|
| 9 |
+
def transcribe_and_translate(audio):
|
| 10 |
+
text = whisper(audio)['text'] #type: ignore
|
| 11 |
+
trans_text = trans_en_ko(text)['translation_text'] #type: ignore
|
| 12 |
+
|
| 13 |
+
return text, trans_text
|
| 14 |
+
|
| 15 |
+
demo = gr.Interface(transcribe_and_translate, 'audio', ['text', 'text'])
|
| 16 |
+
demo.launch()
|
requirements.txt
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
torch, torchaudio, transformers, gradio
|
| 2 |
+
torch
|
| 3 |
+
torchaudio
|
| 4 |
+
gradio
|
| 5 |
+
transformers
|