sharner commited on
Commit
f8dd39f
1 Parent(s): 8ed4df7

Add song list

Browse files
Files changed (2) hide show
  1. app.py +5 -0
  2. list_songs.py +14 -0
app.py CHANGED
@@ -1,6 +1,7 @@
1
  from transformers import pipeline
2
  import gradio as gr
3
  from song_guesser import SongGuesser
 
4
 
5
  pipe = pipeline(model="SamuelHarner/whisper-tuned") # change to "your-username/the-name-you-picked"
6
 
@@ -21,4 +22,8 @@ iface = gr.Interface(
21
  description="Sing a Swedish Christmas song and see if we can guess it. If our guess is wrong, try singing more clearly, more of the lyrics, or another song and maybe we will get it the next time!",
22
  )
23
 
 
 
 
 
24
  iface.launch()
 
1
  from transformers import pipeline
2
  import gradio as gr
3
  from song_guesser import SongGuesser
4
+ from list_songs import ListSongs
5
 
6
  pipe = pipeline(model="SamuelHarner/whisper-tuned") # change to "your-username/the-name-you-picked"
7
 
 
22
  description="Sing a Swedish Christmas song and see if we can guess it. If our guess is wrong, try singing more clearly, more of the lyrics, or another song and maybe we will get it the next time!",
23
  )
24
 
25
+ markdown_text = "The songs that we can guess are: \n" + ListSongs.get_song_list()
26
+
27
+ iface.add_component(gr.Markdown(markdown_text))
28
+
29
  iface.launch()
list_songs.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+
3
+ class ListSongs:
4
+ @staticmethod
5
+ def get_song_list():
6
+ folder_path = './swedish_christmas_songs'
7
+
8
+ list_output = ""
9
+
10
+ for filename in sorted(os.listdir(folder_path)):
11
+ if filename.endswith('.txt'): # Check if the file is a text file
12
+ list_output += "- " + filename[:-4].replace("_", " ") + "\n"
13
+
14
+ return list_output.strip()