maurol commited on
Commit
d570f17
·
1 Parent(s): 50a4788

update app

Browse files
Files changed (1) hide show
  1. app.py +23 -10
app.py CHANGED
@@ -1,9 +1,9 @@
1
  import streamlit as st
2
  from lyrics_translator import LyricsTranslator
3
- import os
4
 
5
 
6
- config = {"GENIUS_ACCESS_TOKEN": st.secrets["GENIUS_ACCESS_TOKEN"]}
 
7
 
8
 
9
  info = """
@@ -52,15 +52,28 @@ if is_button_results:
52
 
53
  col1, col2 = st.columns(2)
54
 
55
- with st.spinner("Song is being translated, this can take a while..."):
56
- with st.container():
57
  try:
58
- lyrics = translator.get_song_translation(song, artist)
59
- st.success(
60
- f"Translated lyrics for '{song}' by '{artist}' to '{language_original}'!"
61
- ) # 👈 Show a success message
62
 
63
- st.text(lyrics)
 
 
64
 
 
 
 
 
 
65
  except ValueError:
66
- st.error("No lyrics found for this song!")
 
 
 
 
 
 
 
1
  import streamlit as st
2
  from lyrics_translator import LyricsTranslator
 
3
 
4
 
5
+ # config = {"GENIUS_ACCESS_TOKEN": st.secrets["GENIUS_ACCESS_TOKEN"]}
6
+ config = None
7
 
8
 
9
  info = """
 
52
 
53
  col1, col2 = st.columns(2)
54
 
55
+ with col1.container():
56
+ with st.spinner("Fetching the song lyrics, this can take a while..."):
57
  try:
58
+ lyrics = translator.get_song_lyrics(song, artist)
59
+ is_success = True
60
+ except ValueError:
61
+ col1.error("No lyrics found for this song!")
62
 
63
+ if is_success:
64
+ col1.success(f"Found lyrics for '{song}' by '{artist}'!")
65
+ col1.text(lyrics)
66
 
67
+ with col2.container():
68
+ with st.spinner("Song is being translated, this can take a while..."):
69
+ try:
70
+ text = translator.get_song_translation(song, artist)
71
+ is_success = True
72
  except ValueError:
73
+ col2.error("No lyrics found for this song!")
74
+
75
+ if is_success:
76
+ col2.success(
77
+ f"Translated lyrics for '{song}' by '{artist}' to '{language_original}'!"
78
+ )
79
+ col2.text(text)