Spaces:
Sleeping
Sleeping
| 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 | |
| ) |