oarab commited on
Commit
19d4aec
·
verified ·
1 Parent(s): 4518fad

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -8
app.py CHANGED
@@ -59,9 +59,9 @@ def transcribe(path):
59
  return [ p([path])[0]["text"], response.text, response.probabilities ]
60
 
61
  dir_path = "samples"
62
- demo = None
63
- with grpc_server.RuntimeGRPCServer() as backend:
64
- demo = gr.Interface(
65
  fn=transcribe,
66
  inputs=gr.Microphone(type="filepath", format="mp3"),
67
  outputs=[ gr.Textbox(label="Default model text"), gr.Textbox(label="Transcription"), gr.Textbox(label="Probabilities") ],
@@ -70,8 +70,5 @@ with grpc_server.RuntimeGRPCServer() as backend:
70
  description = "This demos sends the same audio to the HuggingFace automatic-speech-recognition pipeline default model [facebook/wav2vec2-base-960h](https://huggingface.co/facebook/wav2vec2-base-960h) and the [jonatasgrosman/wav2vec2-large-xlsr-53-english](https://huggingface.co/jonatasgrosman/wav2vec2-large-xlsr-53-english) model.",
71
  article = "Check out [the original model](https://huggingface.co/jonatasgrosman/wav2vec2-large-xlsr-53-english).",
72
  examples= [ path.join(dir_path, file_path) for file_path in sorted(listdir(dir_path)) ]
73
- )
74
- backend
75
-
76
-
77
- demo.launch(share=True)
 
59
  return [ p([path])[0]["text"], response.text, response.probabilities ]
60
 
61
  dir_path = "samples"
62
+
63
+ with grpc_server.RuntimeGRPCServer(inference_service=inference_service, training_service=None) as backend:
64
+ gr.Interface(
65
  fn=transcribe,
66
  inputs=gr.Microphone(type="filepath", format="mp3"),
67
  outputs=[ gr.Textbox(label="Default model text"), gr.Textbox(label="Transcription"), gr.Textbox(label="Probabilities") ],
 
70
  description = "This demos sends the same audio to the HuggingFace automatic-speech-recognition pipeline default model [facebook/wav2vec2-base-960h](https://huggingface.co/facebook/wav2vec2-base-960h) and the [jonatasgrosman/wav2vec2-large-xlsr-53-english](https://huggingface.co/jonatasgrosman/wav2vec2-large-xlsr-53-english) model.",
71
  article = "Check out [the original model](https://huggingface.co/jonatasgrosman/wav2vec2-large-xlsr-53-english).",
72
  examples= [ path.join(dir_path, file_path) for file_path in sorted(listdir(dir_path)) ]
73
+ ).launch()
74
+ backend.wait_for_termination()