Spaces:
Runtime error
Runtime error
Shea
commited on
Commit
·
e5cef20
1
Parent(s):
a9871b8
update
Browse files- app.py +21 -2
- requirements.txt +1 -1
app.py
CHANGED
|
@@ -2,7 +2,26 @@ import gradio as gr
|
|
| 2 |
import numpy as np
|
| 3 |
import pandas as pd
|
| 4 |
from sklearn.metrics.pairwise import cosine_similarity
|
| 5 |
-
from datasets import load_dataset
|
| 6 |
|
| 7 |
-
|
|
|
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
import numpy as np
|
| 3 |
import pandas as pd
|
| 4 |
from sklearn.metrics.pairwise import cosine_similarity
|
|
|
|
| 5 |
|
| 6 |
+
import os
|
| 7 |
+
import requests
|
| 8 |
|
| 9 |
+
url = 'https://huggingface.co/datasets/sheacon/song_lyrics/resolve/main/v2ga_w_embeddings.parquet'
|
| 10 |
+
response = requests.get(url, stream=True)
|
| 11 |
+
|
| 12 |
+
filename = os.path.join(os.getcwd(), url.split('/')[-1])
|
| 13 |
+
with open(filename, 'wb') as file:
|
| 14 |
+
for chunk in response.iter_content(chunk_size=8192):
|
| 15 |
+
if chunk:
|
| 16 |
+
file.write(chunk)
|
| 17 |
+
|
| 18 |
+
print(f"File '{filename}' has been downloaded to the present working directory.")
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
pwd = os.getcwd()
|
| 22 |
+
print("Present Working Directory:", pwd)
|
| 23 |
+
|
| 24 |
+
contents = os.listdir(pwd)
|
| 25 |
+
print("Contents of the Directory:")
|
| 26 |
+
for item in contents:
|
| 27 |
+
print(item)
|
requirements.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
gradio
|
| 2 |
pandas
|
| 3 |
scikit-learn
|
| 4 |
-
|
|
|
|
| 1 |
gradio
|
| 2 |
pandas
|
| 3 |
scikit-learn
|
| 4 |
+
requests
|