LTEnjoy commited on
Commit
40ee819
1 Parent(s): 2e20d0d
Files changed (2) hide show
  1. Dockerfile +1 -1
  2. run.py +27 -0
Dockerfile CHANGED
@@ -27,7 +27,7 @@ RUN chmod +x /tmp/TMalign
27
  RUN huggingface-cli download westlake-repl/ProTrek_650M_UniRef50 --repo-type model --local-dir /tmp/ProTrek_650M_UniRef50
28
 
29
  # Download ProTrek faiss index
30
- RUN huggingface-cli download westlake-repl/ProTrek-faiss-index --repo-type dataset --local-dir /tmp/ProTrek-faiss-index
31
 
32
  # Set up a new user named "user" with user ID 1000
33
  RUN useradd -m -u 1000 user
 
27
  RUN huggingface-cli download westlake-repl/ProTrek_650M_UniRef50 --repo-type model --local-dir /tmp/ProTrek_650M_UniRef50
28
 
29
  # Download ProTrek faiss index
30
+ RUN huggingface-cli download westlake-repl/ProTrek-faiss-index --repo-type dataset --local-dir /tmp/ProTrek-faiss-index --include "ProTrek_650M_UniRef50/Swiss-Prot/*"
31
 
32
  # Set up a new user named "user" with user ID 1000
33
  RUN useradd -m -u 1000 user
run.py CHANGED
@@ -4,6 +4,8 @@ if root_dir not in sys.path:
4
  sys.path.append(root_dir)
5
 
6
  import gradio as gr
 
 
7
 
8
  from demo.modules.search import build_search_module
9
  from demo.modules.compute_score import build_score_computation
@@ -17,6 +19,31 @@ with gr.Blocks() as demo:
17
  build_TMalign()
18
 
19
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  if __name__ == '__main__':
 
 
 
21
  # Run the demo
22
  demo.launch()
 
4
  sys.path.append(root_dir)
5
 
6
  import gradio as gr
7
+ import asyncio
8
+ import os
9
 
10
  from demo.modules.search import build_search_module
11
  from demo.modules.compute_score import build_score_computation
 
19
  build_TMalign()
20
 
21
 
22
+ # Asynchronously download the required index files
23
+ async def run_cmd(cmd):
24
+ process = await asyncio.create_subprocess_shell(
25
+ cmd,
26
+ stdout=asyncio.subprocess.PIPE,
27
+ stderr=asyncio.subprocess.PIPE
28
+ )
29
+ stdout, stderr = await process.communicate()
30
+ print(f'[{cmd!r} exited with {process.returncode}]')
31
+ if stdout:
32
+ print(f'[stdout]\n{stdout.decode()}')
33
+ if stderr:
34
+ print(f'[stderr]\n{stderr.decode()}')
35
+
36
+
37
+ async def download_faiss_index():
38
+ await asyncio.gather(
39
+ run_cmd("Hello World!"),
40
+ run_cmd('huggingface-cli download westlake-repl/ProTrek-faiss-index --repo-type dataset --local-dir /tmp/ProTrek-faiss-index --include "ProTrek_650M_UniRef50/UniRef50/*"'),
41
+ )
42
+
43
+
44
  if __name__ == '__main__':
45
+ # Run the async function to download the index files
46
+ asyncio.run(download_faiss_index())
47
+
48
  # Run the demo
49
  demo.launch()