Spaces:
Sleeping
Sleeping
Deepak Sahu
commited on
Commit
·
5fd2b7a
1
Parent(s):
07f8ff0
check api reachability
Browse files- .gitattributes +1 -0
- .gitignore +1 -0
- app.py +2 -1
- requirements.txt +2 -1
- test1.py +46 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
.wav filter=lfs diff=lfs merge=lfs -text
|
.gitignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
/sb-voiceBot
|
app.py
CHANGED
|
@@ -1,7 +1,8 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
|
| 3 |
def greet(name):
|
| 4 |
-
return "Hello " + name + "!!"
|
| 5 |
|
| 6 |
demo = gr.Interface(fn=greet, inputs="text", outputs="text")
|
| 7 |
demo.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from test1 import foo
|
| 3 |
|
| 4 |
def greet(name):
|
| 5 |
+
return "Hello " + name + "!!" + foo()
|
| 6 |
|
| 7 |
demo = gr.Interface(fn=greet, inputs="text", outputs="text")
|
| 8 |
demo.launch()
|
requirements.txt
CHANGED
|
@@ -1 +1,2 @@
|
|
| 1 |
-
gradio
|
|
|
|
|
|
| 1 |
+
gradio
|
| 2 |
+
nvidia-riva-client
|
test1.py
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import riva.client
|
| 2 |
+
from riva.client.argparse_utils import add_asr_config_argparse_parameters, add_connection_argparse_parameters
|
| 3 |
+
import os
|
| 4 |
+
|
| 5 |
+
uri = "grpc.nvcf.nvidia.com:443"
|
| 6 |
+
|
| 7 |
+
auth = riva.client.Auth(
|
| 8 |
+
uri=uri,
|
| 9 |
+
use_ssl=True,
|
| 10 |
+
metadata_args=[
|
| 11 |
+
["function-id", "b702f636-f60c-4a3d-a6f4-f3568c13bd7d"],
|
| 12 |
+
["authorization", f"Bearer {os.environ['NVIDIA_API']}"],
|
| 13 |
+
]
|
| 14 |
+
)
|
| 15 |
+
|
| 16 |
+
asr_service = riva.client.ASRService(auth)
|
| 17 |
+
|
| 18 |
+
# offline_config = riva.client.RecognitionConfig(
|
| 19 |
+
# encoding=riva.client.AudioEncoding.LINEAR_PCM,
|
| 20 |
+
# max_alternatives=1,
|
| 21 |
+
# enable_automatic_punctuation=True,
|
| 22 |
+
# verbatim_transcripts=False,
|
| 23 |
+
# )
|
| 24 |
+
offline_config = riva.client.RecognitionConfig(
|
| 25 |
+
language_code="en-US",
|
| 26 |
+
# model=args.model_name,
|
| 27 |
+
max_alternatives=1,
|
| 28 |
+
# profanity_filter=args.profanity_filter,
|
| 29 |
+
enable_automatic_punctuation=True,
|
| 30 |
+
verbatim_transcripts=False,
|
| 31 |
+
# enable_word_time_offsets=args.word_time_offsets or args.speaker_diarization,
|
| 32 |
+
)
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
with open("./en-US_sample.wav", 'rb') as fh:
|
| 37 |
+
data = fh.read()
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
def foo():
|
| 41 |
+
global data, offline_config, asr_service
|
| 42 |
+
response = asr_service.offline_recognize(data, offline_config)
|
| 43 |
+
return response
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
|