Stanisław Kacprzak commited on
Commit
4e56594
1 Parent(s): d6f585d

preventing errors

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -19,6 +19,7 @@ with open("height_estimator_0.pickle", "rb") as file:
19
  female_clf = pickle.load(file)
20
 
21
  article_md = Path("Description.md")
 
22
 
23
 
24
  def read_markdown_file(file_path):
@@ -39,11 +40,13 @@ def get_speech(wav):
39
 
40
 
41
  def estimate_height(gender, vad, filepath, imperial):
 
 
42
  signal = read_audio(filepath)
43
  if vad:
44
  signal = get_speech(signal)
45
  if len(signal) < 1:
46
- return f"No speech detected or signal too short!"
47
 
48
 
49
  embedding = torch.squeeze(classifier.encode_batch(signal), 0)
 
19
  female_clf = pickle.load(file)
20
 
21
  article_md = Path("Description.md")
22
+ error_message = "No speech detected or signal too short!"
23
 
24
 
25
  def read_markdown_file(file_path):
 
40
 
41
 
42
  def estimate_height(gender, vad, filepath, imperial):
43
+ if filepath is None:
44
+ return error_message
45
  signal = read_audio(filepath)
46
  if vad:
47
  signal = get_speech(signal)
48
  if len(signal) < 1:
49
+ return error_message
50
 
51
 
52
  embedding = torch.squeeze(classifier.encode_batch(signal), 0)