fabianzeiher commited on
Commit
a64dd7c
·
1 Parent(s): f1e1b93

fix sad smiley not appearing

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -29,12 +29,13 @@ def transcribe(audio):
29
  text_raw= pipe_raw(audio)["text"]
30
  time_raw = time.time() - start
31
  print(f"Raw: audio transcribed in {time_raw} seconds: {text_raw}")
 
32
  sentiment= sa(text_sv)
33
  print(f"Sentiment result: {sentiment}")
34
  sentiment= sentiment[0]["label"]
35
- path = "https://upload.wikimedia.org/wikipedia/commons/thumb/e/e0/SNice.svg/1200px-SNice.svg.png"
36
- if sentiment == "NEGATIVE":
37
- path = "https://upload.wikimedia.org/wikipedia/commons/thumb/4/42/Sad_smiley_yellow_simple.svg/240px-Sad_smiley_yellow_simple.svg.png"
38
 
39
  description = f"The fine-tuned model took {time_fine} seconds while the original Whisper model took {time_raw} seconds.\nThe sentiment was evaluated from the fine-tuned model transcription as {sentiment.lower()}."
40
  return text_sv, text_raw, path, description
 
29
  text_raw= pipe_raw(audio)["text"]
30
  time_raw = time.time() - start
31
  print(f"Raw: audio transcribed in {time_raw} seconds: {text_raw}")
32
+
33
  sentiment= sa(text_sv)
34
  print(f"Sentiment result: {sentiment}")
35
  sentiment= sentiment[0]["label"]
36
+ happy_path = "https://upload.wikimedia.org/wikipedia/commons/thumb/e/e0/SNice.svg/1200px-SNice.svg.png"
37
+ sad_path = "https://upload.wikimedia.org/wikipedia/commons/thumb/4/42/Sad_smiley_yellow_simple.svg/240px-Sad_smiley_yellow_simple.svg.png"
38
+ path = happy_path if sentiment == "POSITIVE" or sad_path
39
 
40
  description = f"The fine-tuned model took {time_fine} seconds while the original Whisper model took {time_raw} seconds.\nThe sentiment was evaluated from the fine-tuned model transcription as {sentiment.lower()}."
41
  return text_sv, text_raw, path, description