Browse Source

Fixing mic example, checking if there is a Spanish system deployed

jjorgeDSIC 4 years ago
parent
commit
20fdcc398c
1 changed files with 5 additions and 1 deletions
  1. 5 1
      python_examples/client.mic.py

+ 5 - 1
python_examples/client.mic.py

@@ -42,13 +42,17 @@ def myStreamIterator():
     stream.stop_stream()
     stream.stop_stream()
     stream.close()
     stream.close()
     p.terminate()
     p.terminate()
-    
+
+es_system = {}
 
 
 #Select Spanish system for testing
 #Select Spanish system for testing
 for system in systems:
 for system in systems:
     if system['info']['langs'][0]['code'] == "es":
     if system['info']['langs'][0]['code'] == "es":
         es_system = system    
         es_system = system    
 
 
+if es_system == {}:
+    raise Exception("Spanish system not found") 
+        
 #Selects the system with the system id for the Spanish system, updated in Feb20
 #Selects the system with the system id for the Spanish system, updated in Feb20
 for resp in cli.transcribe(es_system, myStreamIterator):
 for resp in cli.transcribe(es_system, myStreamIterator):
     # Hyp_var contains part of the hypothesis that is not consolidated yet (hypothesis could change)
     # Hyp_var contains part of the hypothesis that is not consolidated yet (hypothesis could change)