limitedonly41 commited on
Commit
a924c9d
·
verified ·
1 Parent(s): 8c5386e

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -0
app.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import sys
2
+ import os
3
+ from huggingface_hub import snapshot_download
4
+
5
+ # Download your private Gradio app from the private model repo
6
+ print("Downloading private code...")
7
+ repo_path = snapshot_download(
8
+ repo_id="limitedonly41/pdf_ocr", # Replace with your private repo
9
+ repo_type="model",
10
+ token=os.getenv("HF_TOKEN"), # Space will use its own token automatically
11
+ ignore_patterns=["*.md", "*.txt", ".git*"] # Optional: ignore unnecessary files
12
+ )
13
+
14
+ print(f"Code downloaded to: {repo_path}")
15
+
16
+ # Add the downloaded code to Python path
17
+ sys.path.insert(0, repo_path)
18
+
19
+ # Import and launch the Gradio app from your private repo
20
+ print("Loading Gradio app...")
21
+ from ocr import demo
22
+
23
+ if __name__ == "__main__":
24
+ # Launch the app
25
+ demo.queue(max_size=20).launch(
26
+ server_name="0.0.0.0",
27
+ server_port=7860,
28
+ show_error=True
29
+ )