Spaces:
Runtime error
Runtime error
| #!/usr/bin/env python3 | |
| """ | |
| Gradio-based tool to remove vision components from Qwen models and upload to Hugging Face. | |
| This can be deployed as a Hugging Face Space with OAuth authentication. | |
| Uses git clone/commit/push for efficient storage usage in Spaces. | |
| Entry point for the Blindfold Model application. | |
| """ | |
| import os | |
| import logging | |
| import gradio as gr | |
| from ui import create_interface | |
| # Set up logging | |
| logging.basicConfig(level=logging.INFO) | |
| logger = logging.getLogger(__name__) | |
| # Check if running in Hugging Face Space | |
| IS_HF_SPACE = os.environ.get("SPACE_ID") is not None | |
| if __name__ == "__main__": | |
| interface = create_interface() | |
| # Disable share on Hugging Face Spaces (not supported) | |
| # Use queue to handle long-running operations and prevent timeouts | |
| # The queue allows the server to process long tasks without blocking the connection | |
| interface.queue( | |
| default_concurrency_limit=1, # Process one request at a time | |
| max_size=10, # Maximum number of requests in queue | |
| ) | |
| interface.launch( | |
| share=not IS_HF_SPACE, # Only enable share when not running on HF Space | |
| theme=gr.themes.Soft(), | |
| css=""" | |
| .gradio-container { | |
| max-width: 1200px !important; | |
| } | |
| """, | |
| ) | |