A curated collection of practical AI projects implementing OCR systems, RAG, AI agents, and other AI use cases.
audit: fix startup_analyst - rewrite em dashes, add docstrings, remove invalid pip reference, fix pyproject description, add report download button
Tiioluwani440b9d4efd23
diff --git a/ai_agents/startup_analyst/README.md b/ai_agents/startup_analyst/README.mdindex aa3e200..c26a9db 100644--- a/ai_agents/startup_analyst/README.md+++ b/ai_agents/startup_analyst/README.md@@ -23,12 +23,12 @@ The agent is powered by **MiniMax M2.5** (via OpenRouter) and uses Firecrawl to## Tech Stack**Frameworks and Libraries:**-- [Agno](https://github.com/agno-agi/agno) — agent framework-- [Gradio](https://www.gradio.app/) — web UI with streaming support+- [Agno](https://github.com/agno-agi/agno) for the agent framework+- [Gradio](https://www.gradio.app/) for the web UI with streaming support**Models and APIs:**-- [MiniMax M2.5](https://openrouter.ai/minimax/minimax-m2.5) via [OpenRouter](https://openrouter.ai/) — reasoning and report generation-- [Firecrawl](https://firecrawl.dev/) — website scraping and crawling+- [MiniMax M2.5](https://openrouter.ai/minimax/minimax-m2.5) via [OpenRouter](https://openrouter.ai/) for reasoning and report generation+- [Firecrawl](https://firecrawl.dev/) for website scraping and crawling## Prerequisites@@ -53,12 +53,6 @@ cd Hands-On-AI-Engineering/ai_agents/startup_analystuv sync```-Or with pip:--```bash-pip install -r requirements.txt-```-### 3. Set Up Environment Variables```bashdiff --git a/ai_agents/startup_analyst/agent.py b/ai_agents/startup_analyst/agent.pyindex c026735..cdd8711 100644--- a/ai_agents/startup_analyst/agent.py+++ b/ai_agents/startup_analyst/agent.py@@ -14,6 +14,7 @@ MODEL_ID = "minimax/minimax-m2.5:free"def get_analyst() -> Agent:+ """Build and return a configured Startup Analyst agent with Firecrawl scraping and crawling tools."""return Agent(name="Startup Analyst",model=OpenAILike(diff --git a/ai_agents/startup_analyst/app.py b/ai_agents/startup_analyst/app.pyindex c4cccdb..9219090 100644--- a/ai_agents/startup_analyst/app.py+++ b/ai_agents/startup_analyst/app.py@@ -1,5 +1,5 @@"""-Startup Analyst — Gradio UI+Startup Analyst - Gradio UIElite startup due-diligence powered by MiniMax M2.5 via OpenRouter.Usage:@@ -10,6 +10,10 @@ from dotenv import load_dotenvload_dotenv()+import os+import re+import tempfile+import gradio as grfrom agent import analyst@@ -32,15 +36,36 @@ EXAMPLES = [PLACEHOLDER = "_Your due-diligence report will appear here once you submit a company._"+# ── Helpers ────────────────────────────────────────────────────────────────────++def _report_filename(prompt: str) -> str:+ """Derive a sanitized .md filename from the company name in the prompt."""+ match = re.search(r'\bon\s+(.+?)(?:\s*\(https?://)', prompt, re.IGNORECASE)+ if match:+ name = re.sub(r'[^\w\s]', '', match.group(1)).strip()+ name = re.sub(r'\s+', '_', name).lower()+ return f"{name}_analysis.md"+ return "startup_analysis_report.md"+++def _write_report_file(prompt: str, report: str) -> str:+ """Write the report markdown to a temp file and return its path."""+ path = os.path.join(tempfile.gettempdir(), _report_filename(prompt))+ with open(path, "w", encoding="utf-8") as f:+ f.write(report)+ return path++# ── Analysis Function ──────────────────────────────────────────────────────────def run_analysis(prompt: str):+ """Stream a startup intelligence report for the given prompt, yielding (report_markdown, status, download_update) tuples."""prompt = prompt.strip()if not prompt:- yield PLACEHOLDER, ""+ yield PLACEHOLDER, "", gr.update(visible=False)return- yield "_Analysing company — scraping website, crawling pages, gathering data..._", "Running..."+ yield "_Analysing company: scraping website, crawling pages, gathering data..._", "Running...", gr.update(visible=False)full_output = ""try:@@ -50,22 +75,24 @@ def run_analysis(prompt: str):# Only display once the structured report begins (first # heading)heading_idx = full_output.find("#")if heading_idx != -1:- yield full_output[heading_idx:], "Running..."+ yield full_output[heading_idx:], "Running...", gr.update(visible=False)except Exception as exc:heading_idx = full_output.find("#")report = full_output[heading_idx:] if heading_idx != -1 else full_output- yield (report or PLACEHOLDER) + f"\n\n---\n\n**Error:** {exc}", f"Error: {exc}"+ yield (report or PLACEHOLDER) + f"\n\n---\n\n**Error:** {exc}", f"Error: {exc}", gr.update(visible=False)returnif full_output:heading_idx = full_output.find("#")- yield full_output[heading_idx:] if heading_idx != -1 else full_output, "Done."+ report = full_output[heading_idx:] if heading_idx != -1 else full_output+ yield report, "Done.", gr.update(value=_write_report_file(prompt, report), visible=True)else:- yield PLACEHOLDER, "No response received."+ yield PLACEHOLDER, "No response received.", gr.update(visible=False)def clear_all():- return "", PLACEHOLDER, ""+ """Reset the prompt input, report output, status box, and download button to their default empty state."""+ return "", PLACEHOLDER, "", gr.update(value=None, visible=False)# ── Gradio UI ──────────────────────────────────────────────────────────────────@@ -75,7 +102,7 @@ with gr.Blocks(title="Startup Analyst") as demo:gr.Markdown("# 📊 Startup Analyst", elem_id="title")gr.Markdown("Elite startup due-diligence powered by **MiniMax M2.5** via OpenRouter. "- "Enter a company name and URL to get a comprehensive investment-grade analysis — "+ "Enter a company name and URL to get a comprehensive investment-grade analysis ""covering market position, financials, team, risks, and strategic recommendations.",elem_id="subtitle",)@@ -98,13 +125,14 @@ with gr.Blocks(title="Startup Analyst") as demo:)with gr.Row():- status_box = gr.Textbox(label="Status", interactive=False, max_lines=1, scale=1)+ status_box = gr.Textbox(label="Status", interactive=False, max_lines=1, scale=3)+ download_btn = gr.DownloadButton(label="⬇ Download Report (.md)", visible=False, scale=1)report_output = gr.Markdown(value=PLACEHOLDER, elem_id="report")- submit_btn.click(fn=run_analysis, inputs=prompt_input, outputs=[report_output, status_box])- prompt_input.submit(fn=run_analysis, inputs=prompt_input, outputs=[report_output, status_box])- clear_btn.click(fn=clear_all, outputs=[prompt_input, report_output, status_box])+ submit_btn.click(fn=run_analysis, inputs=prompt_input, outputs=[report_output, status_box, download_btn])+ prompt_input.submit(fn=run_analysis, inputs=prompt_input, outputs=[report_output, status_box, download_btn])+ clear_btn.click(fn=clear_all, outputs=[prompt_input, report_output, status_box, download_btn])# ── Entry point ────────────────────────────────────────────────────────────────diff --git a/ai_agents/startup_analyst/pyproject.toml b/ai_agents/startup_analyst/pyproject.tomlindex 5cb5633..4426fa6 100644--- a/ai_agents/startup_analyst/pyproject.toml+++ b/ai_agents/startup_analyst/pyproject.toml@@ -1,7 +1,7 @@[project]name = "startup-analyst"version = "0.1.0"-description = "Elite startup due-diligence agent powered by Qwen3-235B via the orq.ai router"+description = "Elite startup due-diligence agent powered by MiniMax M2.5 via OpenRouter"requires-python = ">=3.11"dependencies = [