Download verify_app.py from HIMANSHUKUMARJHA/deploy-ready-copilot: direct link, hf CLI and curl.
- Browser
- Download file 2.56 kB
-
https://huggingface.co/spaces/HIMANSHUKUMARJHA/deploy-ready-copilot/resolve/main/verify_app.py
- Command line
-
hf download hf://spaces/HIMANSHUKUMARJHA/deploy-ready-copilot/verify_app.py
-
curl -L -o verify_app.py https://huggingface.co/spaces/HIMANSHUKUMARJHA/deploy-ready-copilot/resolve/main/verify_app.py
2.56 kB
| """ | |
| Verification script to test app functionality locally. | |
| """ | |
| import os | |
| import sys | |
| # Add current directory to path | |
| sys.path.append(os.getcwd()) | |
| try: | |
| from app import analyze_input | |
| from rag_agent import RAGAgent | |
| print("β Successfully imported app modules") | |
| except ImportError as e: | |
| print(f"β Import failed: {e}") | |
| sys.exit(1) | |
| def test_rag(): | |
| print("\nTesting RAG Agent...") | |
| agent = RAGAgent() | |
| # Create a dummy file to index | |
| os.makedirs("test_data", exist_ok=True) | |
| with open("test_data/test.txt", "w") as f: | |
| f.write("This is a test file for the RAG agent.") | |
| if not os.getenv("OPENAI_API_KEY"): | |
| print("β οΈ OPENAI_API_KEY not found. Skipping actual indexing/querying.") | |
| return | |
| status = agent.index_codebase("test_data") | |
| print(f"Index Status: {status}") | |
| if "β " in status: | |
| response = agent.query_codebase("What is this file about?") | |
| print(f"Query Response: {response}") | |
| else: | |
| print("β Indexing failed") | |
| def test_analysis(): | |
| print("\nTesting Analysis...") | |
| # Test with manual input to avoid needing a real repo/zip for now | |
| result, project, summary, diagram, fixes = analyze_input(None, "", True) | |
| print(f"Manual Analysis Result: {len(result)} chars") | |
| # Test with user's GitHub repo | |
| repo_url = "https://github.com/himanshu748/Technical_Training_Project" | |
| print(f"Testing with Repo: {repo_url}") | |
| result, project, summary, diagram, fixes = analyze_input(None, repo_url, False) | |
| print(f"GitHub Analysis Result Project Name: {project}") | |
| if "Error" in result: | |
| print(f"β Analysis Failed: {result}") | |
| else: | |
| print(f"β Analysis Successful. Summary length: {len(summary)}") | |
| print(f"β Diagram Generated: {len(diagram)} chars") | |
| print(f"β Fixes Identified: {len(fixes)}") | |
| # Test Updates Check | |
| print("\nTesting Updates Check...") | |
| # Mocking analysis for updates | |
| mock_analysis = {"dependencies": ["flask", "requests", "gunicorn"]} | |
| updates = analyzer.check_updates(mock_analysis) | |
| print(f"β Updates Found: {len(updates)}") | |
| # Test Deployment Trigger | |
| print("\nTesting Deployment Trigger...") | |
| deploy_msg = asyncio.run(deploy_action("Vercel", repo_url)) | |
| print(f"β Deployment Message: {deploy_msg[:50]}...") | |
| if __name__ == "__main__": | |
| # Mocking gradio components for local test | |
| async def deploy_action(platform, repo): | |
| return f"Deployed to {platform}" | |
| test_analysis() | |
| test_rag() | |