Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""
|
| 3 |
+
Hugging Face Spaces wrapper for Firecrawl
|
| 4 |
+
This file is required by HF Spaces - it just runs the bash setup script
|
| 5 |
+
"""
|
| 6 |
+
|
| 7 |
+
import os
|
| 8 |
+
import subprocess
|
| 9 |
+
import sys
|
| 10 |
+
|
| 11 |
+
def main():
|
| 12 |
+
"""Main entry point - just run the bash setup script"""
|
| 13 |
+
print("🔥 Firecrawl on Hugging Face Spaces")
|
| 14 |
+
print("===================================")
|
| 15 |
+
|
| 16 |
+
# Change to the app directory
|
| 17 |
+
os.chdir('/home/firecrawl/app')
|
| 18 |
+
|
| 19 |
+
# Run the setup script directly
|
| 20 |
+
try:
|
| 21 |
+
subprocess.run(['./setup-firecrawl.sh'], check=True)
|
| 22 |
+
except subprocess.CalledProcessError as e:
|
| 23 |
+
print(f"❌ Setup script failed with exit code {e.returncode}")
|
| 24 |
+
sys.exit(e.returncode)
|
| 25 |
+
except KeyboardInterrupt:
|
| 26 |
+
print("\n🛑 Interrupted by user")
|
| 27 |
+
sys.exit(1)
|
| 28 |
+
except Exception as e:
|
| 29 |
+
print(f"❌ Unexpected error: {e}")
|
| 30 |
+
sys.exit(1)
|
| 31 |
+
|
| 32 |
+
if __name__ == "__main__":
|
| 33 |
+
main()
|