sizzlebop's picture
Upload 34 files
4d85aba verified
#!/usr/bin/env python3
"""
πŸŽ“ Course Creator AI - Main Application Entry Point
Launch the Gradio interface for course generation.
Made with ❀️ by Pink Pixel
"Dream it, Pixel it" ✨
"""
import os
import sys
import gradio as gr
from pathlib import Path
# Add the project root to Python path
project_root = Path(__file__).parent
sys.path.insert(0, str(project_root))
from coursecrafter.ui.gradio_app import create_coursecrafter_interface
from coursecrafter.utils.config import config
def setup_backend_credentials():
"""Set up backend credentials for image generation"""
# Set up Pollinations credentials for image generation
if not os.getenv("POLLINATIONS_API_REFERENCE"):
os.environ["POLLINATIONS_API_REFERENCE"] = "course-creator-ai-hf"
print("🎨 Backend image generation credentials configured")
def main():
"""Main application entry point"""
print("πŸŽ“ Starting Course Creator AI...")
# Set up backend credentials
setup_backend_credentials()
# Create and launch the Gradio interface
try:
interface = create_coursecrafter_interface()
# Launch configuration
launch_kwargs = {
"server_name": "0.0.0.0",
"server_port": 7860,
"share": False,
"show_error": True,
"quiet": False
}
# Check if running in Hugging Face Spaces
if os.getenv("SPACE_ID"):
print("πŸš€ Running in Hugging Face Spaces")
launch_kwargs["share"] = True
else:
print("πŸ–₯️ Running locally")
print("🌐 Launching Course Creator AI interface...")
interface.launch(**launch_kwargs)
except Exception as e:
print(f"❌ Failed to launch application: {e}")
sys.exit(1)
if __name__ == "__main__":
main()