--- title: EnochSearch app_file: app.py sdk: gradio sdk_version: 5.49.1 --- # Week 4 Day 3 — `2_lab2.ipynb` on Hugging Face This Space is the **Gradio + LangGraph** app from **`4_langgraph/2_lab2.ipynb`**: - **Tools:** web search (Serper when `SERPER_API_KEY` is set; otherwise DuckDuckGo → Wikipedia → LLM) and optional Pushover. - **Graph:** `chatbot` ↔ `tools` with `tools_condition`, same as the notebook. - **Memory:** `MemorySaver` + `thread_id` so conversation is checkpointed like the “OK it's time to add Memory!” section. ## Secrets (Space → Settings → Repository secrets) | Variable | Required | Notes | |----------|----------|--------| | `OPENAI_API_KEY` | Yes | Chat model `gpt-4o-mini` | | `SERPER_API_KEY` | No | Better search via [serper.dev](https://serper.dev) | | `PUSHOVER_TOKEN` / `PUSHOVER_USER` | No | Push notifications | | `LAB2_THREAD_ID` | No | Defaults to `hf-1`; change to reset logical thread | ## Local run ```bash cd huggingface-project pip install -r requirements.txt # set OPENAI_API_KEY in .env or environment python app.py ``` ## Files | File | Role | |------|------| | `app.py` | Gradio `ChatInterface`, loads graph + memory | | `graph_lab2.py` | `StateGraph`, `ToolNode`, checkpoint compile | | `tools_lab2.py` | `search` + `send_push_notification` | This is **not** the Sidekick / Playwright project (`4_lab4` / `sidekick.py`); no browser automation and **no Docker** is required.