Spaces:
Running
Running
cosmetic
Browse files
app.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
import streamlit as st
|
2 |
from streamlit.elements.altair import generate_chart
|
3 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
@@ -30,11 +31,13 @@ song_name = st.text_input("Enter the desired song name", "Shaolin")
|
|
30 |
|
31 |
|
32 |
|
33 |
-
if st.button("Generate lyrics", help="The lyrics generations lasts about a minute"):
|
34 |
st.title(f"{artist}: {song_name}")
|
35 |
prefix_text = f"<BOS>{song_name} [Verse 1:{artist}]"
|
36 |
generated_song = text_generation(prefix_text, max_length=750, do_sample=True)[0]
|
37 |
for count, line in enumerate(generated_song['generated_text'].split("\n")):
|
|
|
|
|
38 |
if count == 0:
|
39 |
st.markdown(f"**{line[line.find('['):]}**")
|
40 |
continue
|
@@ -43,7 +46,5 @@ if st.button("Generate lyrics", help="The lyrics generations lasts about a minut
|
|
43 |
continue
|
44 |
if line.startswith("["):
|
45 |
st.markdown(f"**{line}**")
|
46 |
-
|
47 |
-
if"<EOS>" in line:
|
48 |
-
break
|
49 |
st.write(line)
|
|
|
1 |
+
from os import CLD_CONTINUED
|
2 |
import streamlit as st
|
3 |
from streamlit.elements.altair import generate_chart
|
4 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
|
|
31 |
|
32 |
|
33 |
|
34 |
+
if st.button("Generate lyrics", help="The lyrics generations lasts for about a minute"):
|
35 |
st.title(f"{artist}: {song_name}")
|
36 |
prefix_text = f"<BOS>{song_name} [Verse 1:{artist}]"
|
37 |
generated_song = text_generation(prefix_text, max_length=750, do_sample=True)[0]
|
38 |
for count, line in enumerate(generated_song['generated_text'].split("\n")):
|
39 |
+
if"<EOS>" in line:
|
40 |
+
break
|
41 |
if count == 0:
|
42 |
st.markdown(f"**{line[line.find('['):]}**")
|
43 |
continue
|
|
|
46 |
continue
|
47 |
if line.startswith("["):
|
48 |
st.markdown(f"**{line}**")
|
49 |
+
CLD_CONTINUED
|
|
|
|
|
50 |
st.write(line)
|