File size: 996 Bytes
1ea9c72
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d5c7f76
1ea9c72
 
 
 
 
 
 
 
 
 
 
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
#!/usr/bin/env python
"""
Hugging Face Spaces app for Math Validator
This is the main entry point for HF Spaces deployment
"""

import os
import sys

# For Hugging Face Spaces, we need to ensure all modules are importable
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))

# Import and run the GUI
from validator_gui import ValidatorGUI

def main():
    """Main entry point for HF Spaces"""
    gui = ValidatorGUI()
    interface = gui.create_interface()
    
    # Launch with HF Spaces settings
    interface.launch(
        server_name="0.0.0.0",  # Required for HF Spaces
        server_port=7860,        # Default HF Spaces port
        share=False              # Sharing handled by HF
    )

if __name__ == "__main__":
    # Check if we're in HF Spaces
    if os.getenv("SPACE_ID"):
        print("Running in Hugging Face Spaces")
        print("Note: Set your API keys in the Spaces Settings > Variables and secrets")
    else:
        print("Running locally")
    
    main()