sharner commited on
Commit
4021dbc
1 Parent(s): ca7a91e

Some small changes to interface

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -13,17 +13,20 @@ def transcribe(audio):
13
 
14
  def get_song_guess(audio):
15
  user_query = transcribe(audio)
 
 
 
16
  output = (
17
  "What Santa heard: "
18
  + user_query
19
- + "\n\nSanta thinks you sang the song: "
20
- + SongGuesser.guess_song(user_query)
21
  )
22
  return output
23
 
24
 
25
- intro_info = "Santa wants you to sing a Swedish Christmas song so he can try to guess it, but keep in mind that Santa is getting old and doesn't hear so well.\nTo help Santa guess correctly, try to sing clearly or more of the lyrics, and make sure to sing one the songs Santa is familiar with from the list below!"
26
- santa_image_md = '<img style="float: right;" src="https://raw.githubusercontent.com/SamuelHarner/app-images/main/images/DALLE-Santa-480.png?raw=true">'
27
  song_info = (
28
  "Santa is familiar with the following Swedish Christmas songs: \n"
29
  + ListSongs.get_song_list()
 
13
 
14
  def get_song_guess(audio):
15
  user_query = transcribe(audio)
16
+ song_guess = SongGuesser.guess_song(user_query)
17
+ if len(song_guess) == 0:
18
+ song_guess = "too badly for him to guess a song" # default output if no song guess
19
  output = (
20
  "What Santa heard: "
21
  + user_query
22
+ + "\n\nSanta thinks you sang: "
23
+ + song_guess
24
  )
25
  return output
26
 
27
 
28
+ intro_info = "Santa wants you to sing a Swedish Christmas song so he can try to guess it, but keep in mind that Santa is getting old and doesn't hear so well.\nTo help Santa guess correctly, try to sing clearly or more of the lyrics, and make sure to sing one of the songs Santa is familiar with from the list below!"
29
+ santa_image_md = '<img width="400" height="400" style="float: right;" src="https://raw.githubusercontent.com/SamuelHarner/app-images/main/images/DALLE-Santa-480.png?raw=true">'
30
  song_info = (
31
  "Santa is familiar with the following Swedish Christmas songs: \n"
32
  + ListSongs.get_song_list()