Spaces:
Sleeping
Sleeping
| """ | |
| Local testing script for the CBIR app | |
| Test your app before deploying to HuggingFace | |
| """ | |
| import os | |
| import sys | |
| # Set environment before importing app | |
| os.environ['IMAGE_BASE_DIR'] = './images' # Set your image directory | |
| print("="*60) | |
| print("Testing CBIR App Locally") | |
| print("="*60) | |
| print("\nLoading models and FAISS index...") | |
| print("This may take a few minutes on first run...") | |
| print("="*60 + "\n") | |
| # Import and run the app | |
| from app import demo | |
| if __name__ == "__main__": | |
| print("\n" + "="*60) | |
| print("Starting Gradio interface...") | |
| print("="*60) | |
| demo.launch( | |
| share=True, # Create public Gradio link for sharing | |
| server_name="0.0.0.0", # Allow external connections | |
| server_port=7860, | |
| debug=True, | |
| inbrowser=True # Automatically open browser | |
| ) | |
| print("\n✓ Server started!") | |
| print("✓ Open your browser to: http://127.0.0.1:7860") | |
| print("\nPress Ctrl+C to stop the server") | |
| print("="*60) | |