Spaces:
Sleeping
Sleeping
fixing user permission
Browse files- Dockerfile +23 -12
- app.py +1 -1
Dockerfile
CHANGED
@@ -1,14 +1,25 @@
|
|
1 |
FROM python:3.8.1-slim-buster
|
2 |
|
|
|
|
|
3 |
|
4 |
-
|
|
|
5 |
|
6 |
-
|
|
|
7 |
|
8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
-
RUN apt-get update
|
11 |
-
RUN apt-get install build-essential -y
|
12 |
# RUN pip install --no-cache-dir -r requirements.txt
|
13 |
RUN pip install torch==1.8.1+cu111 torchvision==0.9.1+cu111 torchaudio==0.8.1 -f https://download.pytorch.org/whl/torch_stable.html
|
14 |
# WORKDIR fairseq-a54021305d6b3c4c5959ac9395135f63202db8f1
|
@@ -17,17 +28,17 @@ RUN pip install -r requirements.txt --no-cache-dir
|
|
17 |
RUN pip install gradio --no-cache-dir
|
18 |
RUN pip install protobuf==3.20.* --no-cache-dir
|
19 |
|
20 |
-
# Switch to the "user" user
|
21 |
-
USER user
|
22 |
|
23 |
-
# Set home to the user's home directory
|
24 |
-
ENV HOME=/home/user \
|
25 |
-
|
26 |
|
27 |
# Set the working directory to the user's home directory
|
28 |
-
WORKDIR $HOME/code
|
29 |
|
30 |
-
COPY --chown=user . $HOME/code
|
31 |
# RUN ls -la $HOME/code
|
32 |
# RUN chown -r 777:777 /code
|
33 |
CMD ["python3", "app.py"]
|
|
|
1 |
FROM python:3.8.1-slim-buster
|
2 |
|
3 |
+
RUN apt-get update
|
4 |
+
RUN apt-get install build-essential -y
|
5 |
|
6 |
+
# create a new user
|
7 |
+
# RUN useradd -m -u 1000 user
|
8 |
|
9 |
+
# Switch to the "user" user
|
10 |
+
# USER user
|
11 |
|
12 |
+
# Set home to the user's home directory
|
13 |
+
# ENV HOME=/home/user \
|
14 |
+
# PATH=/home/user/.local/bin:$PATH
|
15 |
+
|
16 |
+
# Set the working directory to the user's home directory
|
17 |
+
# WORKDIR $HOME/code
|
18 |
+
|
19 |
+
WORKDIR /code
|
20 |
+
# COPY . $HOME/code
|
21 |
+
COPY . .
|
22 |
|
|
|
|
|
23 |
# RUN pip install --no-cache-dir -r requirements.txt
|
24 |
RUN pip install torch==1.8.1+cu111 torchvision==0.9.1+cu111 torchaudio==0.8.1 -f https://download.pytorch.org/whl/torch_stable.html
|
25 |
# WORKDIR fairseq-a54021305d6b3c4c5959ac9395135f63202db8f1
|
|
|
28 |
RUN pip install gradio --no-cache-dir
|
29 |
RUN pip install protobuf==3.20.* --no-cache-dir
|
30 |
|
31 |
+
# # Switch to the "user" user
|
32 |
+
# USER user
|
33 |
|
34 |
+
# # Set home to the user's home directory
|
35 |
+
# ENV HOME=/home/user \
|
36 |
+
# PATH=/home/user/.local/bin:$PATH
|
37 |
|
38 |
# Set the working directory to the user's home directory
|
39 |
+
# WORKDIR $HOME/code
|
40 |
|
41 |
+
# COPY --chown=user . $HOME/code
|
42 |
# RUN ls -la $HOME/code
|
43 |
# RUN chown -r 777:777 /code
|
44 |
CMD ["python3", "app.py"]
|
app.py
CHANGED
@@ -33,7 +33,7 @@ class DFSeparationApp:
|
|
33 |
|
34 |
def predict(self, audio_file):
|
35 |
# Load the audio file
|
36 |
-
audio_tensor = torch.tensor(audio_file[
|
37 |
with torch.no_grad():
|
38 |
# Make prediction
|
39 |
output = self.model(audio_tensor)
|
|
|
33 |
|
34 |
def predict(self, audio_file):
|
35 |
# Load the audio file
|
36 |
+
audio_tensor = torch.tensor(audio_file[0]).to(self.device)
|
37 |
with torch.no_grad():
|
38 |
# Make prediction
|
39 |
output = self.model(audio_tensor)
|