Spaces:
Sleeping
Sleeping
Merge branch 'main' of https://huggingface.co/spaces/arpy8/spotify-api
Browse files- Dockerfile +9 -1
- app/main.py +2 -2
Dockerfile
CHANGED
@@ -2,10 +2,18 @@ FROM python:3.11
|
|
2 |
|
3 |
WORKDIR /code
|
4 |
|
|
|
|
|
5 |
COPY ./requirements.txt /code/requirements.txt
|
6 |
|
7 |
-
|
|
|
|
|
|
|
|
|
8 |
|
9 |
COPY ./app /code/app
|
10 |
|
|
|
|
|
11 |
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
2 |
|
3 |
WORKDIR /code
|
4 |
|
5 |
+
USER root
|
6 |
+
|
7 |
COPY ./requirements.txt /code/requirements.txt
|
8 |
|
9 |
+
ADD --chmod=755 https://astral.sh/uv/install.sh /install.sh
|
10 |
+
|
11 |
+
RUN /install.sh && rm /install.sh
|
12 |
+
|
13 |
+
RUN /root/.cargo/bin/uv pip install --system --no-cache -r requirements.txt
|
14 |
|
15 |
COPY ./app /code/app
|
16 |
|
17 |
+
USER user
|
18 |
+
|
19 |
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
|
app/main.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
import bs4
|
2 |
import time
|
3 |
import pytz
|
@@ -25,13 +26,12 @@ def get_data():
|
|
25 |
response = requests.get(API_URL)
|
26 |
soup = bs4.BeautifulSoup(response.text, "html.parser")
|
27 |
|
|
|
28 |
header_text = soup.find("div", class_="playing").text.split(" on")[0]
|
29 |
artist = soup.find("div", class_="song").text
|
30 |
song = soup.find("div", class_="artist").text
|
31 |
base64_cover = soup.findAll("img")[1].attrs["src"].split("base64,")[1].strip()
|
32 |
|
33 |
-
curr_time = ist_time()
|
34 |
-
|
35 |
return {
|
36 |
"time": curr_time,
|
37 |
"header": header_text,
|
|
|
1 |
+
import os
|
2 |
import bs4
|
3 |
import time
|
4 |
import pytz
|
|
|
26 |
response = requests.get(API_URL)
|
27 |
soup = bs4.BeautifulSoup(response.text, "html.parser")
|
28 |
|
29 |
+
curr_time = ist_time()
|
30 |
header_text = soup.find("div", class_="playing").text.split(" on")[0]
|
31 |
artist = soup.find("div", class_="song").text
|
32 |
song = soup.find("div", class_="artist").text
|
33 |
base64_cover = soup.findAll("img")[1].attrs["src"].split("base64,")[1].strip()
|
34 |
|
|
|
|
|
35 |
return {
|
36 |
"time": curr_time,
|
37 |
"header": header_text,
|