File size: 954 Bytes
7ca901a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
30
31
32
33
34
35
36
37
"""
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()