bobfu commited on
Commit
7f45d1d
·
verified ·
1 Parent(s): c50f891

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -0
app.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from huggingface_hub import snapshot_download, hf_hub_download
2
+ import importlib.util
3
+ from pathlib import Path
4
+
5
+ # 1. Download a snapshot of the private Space’s repo into a local cache directory
6
+ cache_dir = Path("private_space_cache")
7
+ cache_dir.mkdir(exist_ok=True)
8
+ snapshot_download(
9
+ repo_id="bobfu/WordDocxFormatConvertor",
10
+ repo_type="space",
11
+ cache_dir=str(cache_dir),
12
+ )
13
+
14
+ # 2. Load the main app script from the private repo
15
+ app_path = cache_dir / "app.py" # Or wherever your entrypoint lives
16
+ spec = importlib.util.spec_from_file_location("private_app", str(app_path))
17
+ private_app = importlib.util.module_from_spec(spec)
18
+ spec.loader.exec_module(private_app)
19
+
20
+ # 3. Call the Gradio interface defined in the private app
21
+ demo = private_app.create_demo() # Example function you defined
22
+ demo.launch()