Spaces:
Runtime error
Runtime error
NimaBoscarino
commited on
Commit
•
21c3f3d
1
Parent(s):
85292f8
Update app.py
Browse files
app.py
CHANGED
@@ -8,16 +8,13 @@ import gradio as gr
|
|
8 |
pd.options.mode.chained_assignment = None # Turn off SettingWithCopyWarning
|
9 |
|
10 |
auth_token = os.environ.get("TOKEN_FROM_SECRET") or True
|
11 |
-
|
12 |
songs = pd.read_csv(hf_hub_download("NimaBoscarino/playlist-generator", repo_type="dataset", filename="songs_new.csv"))
|
13 |
-
verses = pd.read_csv(hf_hub_download("NimaBoscarino/playlist-generator
|
14 |
-
lyrics = pd.read_csv(hf_hub_download("NimaBoscarino/playlist-generator-private", repo_type="dataset", filename="lyrics_new.csv", use_auth_token=
|
15 |
|
16 |
embedder = SentenceTransformer('msmarco-MiniLM-L-6-v3')
|
17 |
|
18 |
-
song_ids = pickled["song_ids"]
|
19 |
-
corpus_embeddings = pickled["embeddings"]
|
20 |
-
|
21 |
|
22 |
def generate_playlist(prompt):
|
23 |
prompt_embedding = embedder.encode(prompt, convert_to_tensor=True)
|
@@ -63,7 +60,7 @@ with demo:
|
|
63 |
gr.Markdown(
|
64 |
"""
|
65 |
Enter a prompt and generate a playlist based on ✨semantic similarity✨
|
66 |
-
This was built using Sentence Transformers and Gradio –
|
67 |
""")
|
68 |
|
69 |
song_prompt = gr.TextArea(
|
|
|
8 |
pd.options.mode.chained_assignment = None # Turn off SettingWithCopyWarning
|
9 |
|
10 |
auth_token = os.environ.get("TOKEN_FROM_SECRET") or True
|
11 |
+
corpus_embeddings = pickle.load(open(hf_hub_download("NimaBoscarino/playlist-generator", repo_type="dataset", filename="verse-embeddings.pkl"), "rb"))
|
12 |
songs = pd.read_csv(hf_hub_download("NimaBoscarino/playlist-generator", repo_type="dataset", filename="songs_new.csv"))
|
13 |
+
verses = pd.read_csv(hf_hub_download("NimaBoscarino/playlist-generator", repo_type="dataset", filename="verses.csv"))
|
14 |
+
lyrics = pd.read_csv(hf_hub_download("NimaBoscarino/playlist-generator-private", repo_type="dataset", filename="lyrics_new.csv", use_auth_token=True))
|
15 |
|
16 |
embedder = SentenceTransformer('msmarco-MiniLM-L-6-v3')
|
17 |
|
|
|
|
|
|
|
18 |
|
19 |
def generate_playlist(prompt):
|
20 |
prompt_embedding = embedder.encode(prompt, convert_to_tensor=True)
|
|
|
60 |
gr.Markdown(
|
61 |
"""
|
62 |
Enter a prompt and generate a playlist based on ✨semantic similarity✨
|
63 |
+
This was built using Sentence Transformers and Gradio – [see the blog](https://huggingface.co/blog/your-first-ml-project)!
|
64 |
""")
|
65 |
|
66 |
song_prompt = gr.TextArea(
|