Spaces:
Sleeping
Sleeping
#!/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() |