Shuwei Hou commited on
Commit
a3b7803
·
1 Parent(s): e7dc5d0

use_hf_storage

Browse files
Files changed (2) hide show
  1. Dockerfile +3 -0
  2. modal_deploy.py +20 -0
Dockerfile CHANGED
@@ -5,6 +5,9 @@ WORKDIR /app
5
 
6
  COPY . .
7
 
 
 
 
8
  RUN conda env create -f environment_sate_0.11.yml
9
 
10
  RUN mkdir -p /app/session_data && chown -R user:user /app/session_data
 
5
 
6
  COPY . .
7
 
8
+ # This is only for building docker in huggingface spaces
9
+ ENV HF_HOME=/data/.huggingface
10
+
11
  RUN conda env create -f environment_sate_0.11.yml
12
 
13
  RUN mkdir -p /app/session_data && chown -R user:user /app/session_data
modal_deploy.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import modal, subprocess, signal
2
+
3
+ app = modal.App("sate-api")
4
+
5
+ image = modal.Image.from_dockerfile("Dockerfile")
6
+
7
+ @app.function(
8
+ image=image,
9
+ min_containers=1,
10
+ timeout=1000,
11
+ gpu="A10G",
12
+ )
13
+
14
+ @modal.web_server(7860)
15
+ def run_server():
16
+ subprocess.Popen([
17
+ "conda", "run", "--no-capture-output", "-n", "SATE",
18
+ "python", "main_socket.py", "--host", "0.0.0.0", "--port", "7860"
19
+ ])
20
+ signal.pause()