ginic commited on
Commit
d079ec5
1 Parent(s): d27d1db

Added sample app functionality

Browse files
Files changed (3) hide show
  1. README.md +5 -2
  2. app.py +25 -0
  3. requirements.txt +2 -0
README.md CHANGED
@@ -1,5 +1,5 @@
1
  ---
2
- title: Multipa English To Ipa
3
  emoji: 🐨
4
  colorFrom: red
5
  colorTo: blue
@@ -9,5 +9,8 @@ app_file: app.py
9
  pinned: false
10
  license: mit
11
  ---
 
 
12
 
13
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
1
  ---
2
+ title: Multipa Audio To Ipa
3
  emoji: 🐨
4
  colorFrom: red
5
  colorTo: blue
 
9
  pinned: false
10
  license: mit
11
  ---
12
+ # About
13
+ This interactive demo allows you to play with audio to International Phonetic Alphabet transcription models trained in the [multIPA](https://github.com/ginic/multipa) project.
14
 
15
+ # Local Testing
16
+ To use audio models locally, you must manually install ffmpeg and ffprobe, see [this discussion](https://discuss.huggingface.co/t/audio-classification-pipeline-valueerror-ffmpeg-was-not-found-but-is-required-to-load-audio-files-from-filename/16137/8).
app.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ from transformers import pipeline
4
+
5
+ MODEL_NAME="ctaguchi/wav2vec2-large-xlsr-japlmthufielta-ipa1000-ns"
6
+ #MODEL_NAME="ginic/wav2vec-large-xlsr-en-ipa")
7
+
8
+ pipe = pipeline(task="automatic-speech-recognition", model=MODEL_NAME)
9
+
10
+ def predict(audio_in):
11
+ return pipe(audio_in)["text"]
12
+
13
+
14
+ def launch_demo():
15
+ with gr.Blocks() as demo:
16
+ gr.Markdown(f"""
17
+ # Automatic International Phonetic Alphabet Transcription
18
+ This demo allows you to experiment with producing phonetic transcriptions of uploaded or recorded audio using the model '{MODEL_NAME}'.
19
+ """)
20
+ gr.Interface(fn=predict, inputs=gr.Audio(type="filepath"), outputs="text", allow_flagging="never")
21
+
22
+ demo.launch()
23
+
24
+ if __name__ == "__main__":
25
+ launch_demo()
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ transformers[torch]
2
+ ffmpeg