File size: 858 Bytes
a924c9d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import sys
import os
from huggingface_hub import snapshot_download

# Download your private Gradio app from the private model repo
print("Downloading private code...")
repo_path = snapshot_download(
    repo_id="limitedonly41/pdf_ocr",  # Replace with your private repo
    repo_type="model",
    token=os.getenv("HF_TOKEN"),  # Space will use its own token automatically
    ignore_patterns=["*.md", "*.txt", ".git*"]  # Optional: ignore unnecessary files
)

print(f"Code downloaded to: {repo_path}")

# Add the downloaded code to Python path
sys.path.insert(0, repo_path)

# Import and launch the Gradio app from your private repo
print("Loading Gradio app...")
from ocr import demo  

if __name__ == "__main__":
    # Launch the app
    demo.queue(max_size=20).launch(
        server_name="0.0.0.0",
        server_port=7860,
        show_error=True
    )