kairunwen commited on
Commit
6f8ebff
·
1 Parent(s): 05a0d9f
Files changed (3) hide show
  1. README.md +1 -1
  2. app.py +0 -7
  3. app_wrapper.py +19 -0
README.md CHANGED
@@ -6,7 +6,7 @@ colorTo: green
6
  sdk: gradio
7
  sdk_version: 4.20.1
8
  python_version: 3.10.13
9
- app_file: app.py
10
  pinned: false
11
  license: mit
12
  ---
 
6
  sdk: gradio
7
  sdk_version: 4.20.1
8
  python_version: 3.10.13
9
+ app_file: app_wrapper.py
10
  pinned: false
11
  license: mit
12
  ---
app.py DELETED
@@ -1,7 +0,0 @@
1
- import gradio as gr
2
- import os
3
- import spaces
4
-
5
- token = os.getenv("HF_TOKEN")
6
-
7
- gr.load("kairunwen/tmp", hf_token=token, src="spaces").launch()
 
 
 
 
 
 
 
 
app_wrapper.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import os
3
+ # import spaces
4
+
5
+ token = os.getenv("HF_TOKEN")
6
+
7
+ # gr.load("kairunwen/tmp", hf_token=token, src="spaces").launch()
8
+
9
+
10
+
11
+ import shlex
12
+ import subprocess
13
+
14
+ from huggingface_hub import HfApi
15
+
16
+ api = HfApi()
17
+ api.snapshot_download(repo_id="kairunwen/tmp", repo_type="space", hf_token=token, local_dir=".")
18
+ subprocess.run(shlex.split("pip install -r requirements.txt"))
19
+ subprocess.run(shlex.split("python app.py"))