Spaces:
Sleeping
Sleeping
| """ | |
| Hugging Face Space compatible version of the agricultural analysis app. | |
| This is the main entry point for deployment on Hugging Face Spaces. | |
| """ | |
| import os | |
| import sys | |
| import gradio as gr | |
| # Add current directory to Python path | |
| sys.path.append(os.path.dirname(os.path.abspath(__file__))) | |
| # Import the main Gradio app | |
| from gradio_app import create_gradio_app | |
| def main(): | |
| """Main function for Hugging Face deployment.""" | |
| # Set up environment | |
| os.environ.setdefault("GRADIO_SERVER_NAME", "0.0.0.0") | |
| os.environ.setdefault("GRADIO_SERVER_PORT", "7860") | |
| # Create and launch the app | |
| app = create_gradio_app() | |
| # Launch with Hugging Face compatible settings | |
| app.launch( | |
| server_name="0.0.0.0", | |
| server_port=7860, | |
| share=False, # Don't share in HF Spaces | |
| debug=False, # Disable debug in production | |
| show_error=True, | |
| quiet=False | |
| ) | |
| if __name__ == "__main__": | |
| main() | |