Spaces:
Sleeping
Sleeping
| """ | |
| Main Entry Point for Lead Generation System | |
| ============================================ | |
| Wrapper script that runs the DOE orchestrator. | |
| """ | |
| import os | |
| import sys | |
| # Ensure we're using the venv | |
| venv_path = os.path.join(os.path.dirname(__file__), "venv", "bin", "python") | |
| if os.path.exists(venv_path) and sys.executable != venv_path: | |
| os.execv(venv_path, [venv_path] + sys.argv) | |
| # Add paths | |
| sys.path.insert(0, os.path.dirname(__file__)) | |
| from l2_orchestration.orchestrator import ( | |
| run_full_pipeline, | |
| run_scraping_only, | |
| run_whatsapp_outreach, | |
| run_email_outreach, | |
| show_dashboard | |
| ) | |
| from l3_execution.database_doe import init_db | |
| if __name__ == "__main__": | |
| import argparse | |
| parser = argparse.ArgumentParser( | |
| description="🚀 Lead Generation DOE System", | |
| formatter_class=argparse.RawDescriptionHelpFormatter, | |
| epilog=""" | |
| Ejemplos: | |
| python main.py --pipeline --niche real_estate --country usa --location "Miami, FL" | |
| python main.py --scrape --niche insurance --country venezuela --location "Caracas" | |
| python main.py --outreach-wa --limit 10 | |
| python main.py --dashboard | |
| python main.py --streamlit | |
| """ | |
| ) | |
| # Actions | |
| parser.add_argument("--pipeline", action="store_true", help="Ejecutar pipeline completo") | |
| parser.add_argument("--scrape", action="store_true", help="Solo scraping de leads") | |
| parser.add_argument("--outreach-wa", action="store_true", help="Generar links de WhatsApp") | |
| parser.add_argument("--outreach-email", action="store_true", help="Preview/enviar emails") | |
| parser.add_argument("--dashboard", action="store_true", help="Dashboard en texto") | |
| parser.add_argument("--streamlit", action="store_true", help="Dashboard web Streamlit") | |
| # Options | |
| parser.add_argument("--niche", choices=["real_estate", "insurance"], default="real_estate", | |
| help="Nicho objetivo (default: real_estate)") | |
| parser.add_argument("--country", choices=["usa", "venezuela"], default="usa", | |
| help="País objetivo (default: usa)") | |
| parser.add_argument("--limit", type=int, default=10, help="Límite de leads (default: 10)") | |
| parser.add_argument("--location", type=str, help="Ubicación específica (Ciudad, Estado o ZIP)") | |
| parser.add_argument("--demo", action="store_true", help="Modo demo sin API") | |
| args = parser.parse_args() | |
| # Initialize DB | |
| init_db() | |
| # Execute action | |
| if args.pipeline: | |
| run_full_pipeline( | |
| niche=args.niche, | |
| country=args.country, | |
| location=args.location, | |
| limit_per_city=args.limit, | |
| demo=args.demo | |
| ) | |
| elif args.scrape: | |
| run_scraping_only( | |
| niche=args.niche, | |
| country=args.country, | |
| location=args.location, | |
| limit=args.limit | |
| ) | |
| elif args.outreach_wa: | |
| run_whatsapp_outreach(limit=args.limit) | |
| elif args.outreach_email: | |
| run_email_outreach(limit=args.limit, preview_only=True) | |
| elif args.dashboard: | |
| show_dashboard() | |
| elif args.streamlit: | |
| import subprocess | |
| dashboard_path = os.path.join(os.path.dirname(__file__), "dashboard", "app.py") | |
| venv_streamlit = os.path.join(os.path.dirname(__file__), "venv", "bin", "streamlit") | |
| subprocess.run([venv_streamlit, "run", dashboard_path, "--server.headless", "true"]) | |
| else: | |
| # Show help if no action | |
| parser.print_help() | |
| print("\n📊 Estado actual:") | |
| show_dashboard() | |