File size: 6,829 Bytes
993c6b4
 
3c3e122
 
 
993c6b4
3c3e122
8545a9b
993c6b4
 
 
3c3e122
993c6b4
 
3c3e122
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
---
title: InstaAutoApp TeamDataMavericks
emoji: πŸš—
colorFrom: red
colorTo: yellow
sdk: gradio
sdk_version: "4.44.1"
python_version: "3.11"
app_file: app.py
pinned: false
license: mit
short_description: AI-Powered Symptom Triage for 2023 Ford Bronco
---

# πŸš— Insta-AutoApp

**AI-Powered Symptom Triage for 2023 Ford Bronco**

Insta-AutoApp is a RAG-based (Retrieval-Augmented Generation) application that helps 2023 Ford Bronco owners understand warning lights and vehicle symptoms. Describe your issue in plain English and receive structured, OEM-grounded triage guidance in under 60 seconds.

---

## 🌟 Features

- **OEM-Grounded Responses**: All answers are based on the official 2023 Ford Bronco Owner's Manual
- **Structured Triage Output**: Every response includes Urgency Level, Likely Meaning, Next Step, and OEM Citation
- **Vehicle-Specific Follow-ups**: AI asks Bronco-specific clarifying questions (GOAT modes, Sasquatch package, etc.)
- **Safety-First Design**: Conservative defaults for brake, steering, and drivetrain issues
- **No Fabrication**: If the manual doesn't cover it, the app says so

---

## πŸš€ Quick Start

### Prerequisites

- Python 3.10+
- HuggingFace API token ([get one here](https://huggingface.co/settings/tokens))
- 2023 Ford Bronco Owner's Manual PDF

### Installation

1. **Clone or download this repository**

```bash
git clone https://github.com/your-repo/insta-autoapp.git
cd insta-autoapp
```

2. **Create a virtual environment (recommended)**

```bash
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
```

3. **Install dependencies**

```bash
pip install -r requirements.txt
```

4. **Configure environment**

```bash
cp .env.example .env
# Edit .env and add your HuggingFace API token
```

5. **Ingest the OEM Manual** (one-time setup)

```bash
# Place your Bronco manual PDF in a convenient location
python ingest.py path/to/bronco_2023_manual.pdf
```

6. **Launch the app**

```bash
python app.py
```

7. **Open in browser**: http://localhost:7860

---

## πŸ“ Project Structure

```
insta-autoapp/
β”œβ”€β”€ app.py              # Main Gradio application
β”œβ”€β”€ config.py           # Configuration constants
β”œβ”€β”€ prompts.py          # LLM system prompts
β”œβ”€β”€ llm_client.py       # HuggingFace Inference API client
β”œβ”€β”€ rag_pipeline.py     # FAISS retrieval logic
β”œβ”€β”€ ingest.py           # PDF preprocessing script
β”œβ”€β”€ requirements.txt    # Python dependencies
β”œβ”€β”€ .env.example        # Environment template
β”œβ”€β”€ README.md           # This file
└── data/               # FAISS index (created by ingest.py)
    β”œβ”€β”€ index.faiss
    └── index.pkl
```

---

## πŸ”§ Configuration

### Environment Variables

| Variable | Required | Default | Description |
|----------|----------|---------|-------------|
| `HF_API_TOKEN` | Yes | - | HuggingFace API token for LLM inference |
| `HF_MODEL_ID` | No | `Qwen/Qwen2.5-72B-Instruct` | Model ID for inference |
| `TOP_K` | No | `5` | Number of chunks to retrieve |

### Vehicle Profile Options

The app only accepts valid 2023 Ford Bronco configurations:

- **Trim**: Base, Big Bend, Black Diamond, Badlands, Outer Banks, Wildtrak, Raptor
- **Engine**: 2.3L EcoBoost, 2.7L EcoBoost
- **Package**: None, Sasquatch, Lux, Sasquatch + Lux
- **Top Type**: Soft Top, Hard Top, Modular Top
- **Mileage**: 0 - 300,000

---

## πŸ€– How It Works

### Architecture

```
User Input (Symptom)
       β”‚
       β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Follow-up Gen    β”‚ ◄── LLM (Qwen2.5-72B)
β”‚ (1-2 questions)  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚
         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Combined Query   β”‚ = Symptom + Vehicle Profile + Follow-up Answers
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚
         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ FAISS Retrieval  β”‚ ◄── Top-5 OEM manual chunks
β”‚ (all-MiniLM-L6)  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚
         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Triage Gen       β”‚ ◄── LLM with retrieved context
β”‚ (4-field output) β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚
         β–Ό
   Structured Response
   + Disclaimer
```

### Urgency Levels

| Level | Meaning | Action |
|-------|---------|--------|
| **Safe** | Cosmetic or informational | No action required |
| **Monitor** | Non-critical issue | Check within 7 days if persists |
| **Urgent** | Needs attention | Schedule service, limit driving |
| **Do Not Drive** | Safety-critical | Stop immediately, seek assistance |

---

## πŸš€ Deployment to HuggingFace Spaces

1. **Create a new Space** at https://huggingface.co/new-space
   - Select "Gradio" as the SDK
   - Choose a name (e.g., `insta-autoapp`)

2. **Clone the Space repository**

```bash
git clone https://huggingface.co/spaces/YOUR_USERNAME/insta-autoapp
cd insta-autoapp
```

3. **Copy all files** from this project into the Space folder

4. **Add your FAISS index** (from running `ingest.py` locally)
   - Copy `data/index.faiss` and `data/index.pkl` to the Space

5. **Set Space Secrets**
   - Go to Settings β†’ Variables and secrets
   - Add `HF_API_TOKEN` as a secret

6. **Push to deploy**

```bash
git add .
git commit -m "Initial deployment"
git push
```

---

## ⚠️ Limitations

- **Single Vehicle**: V1 supports only 2023 Ford Bronco. Multi-vehicle support planned for V2.
- **Text Only**: No image/photo upload. No voice input.
- **Ephemeral Sessions**: Vehicle profile and history are not saved across sessions.
- **Table Extraction**: Table-heavy manual sections (fluid specs, fuse layouts) may have degraded extraction quality.
- **Not a Diagnosis**: This is triage guidance, not professional mechanical advice.

---

## πŸ”’ Privacy

- **No PII Collected**: No names, emails, or personal data stored
- **Ephemeral Sessions**: All session data is lost when browser closes
- **Local Data**: FAISS index stored locally, not transmitted
- **API Calls**: Only symptom text is sent to HuggingFace API for inference

---

## πŸ“ License

MIT License - See LICENSE file for details.

---

## πŸ‘₯ Team

**Data Mavericks** - ANLY 601 Advanced Coding for Business  
Texas A&M University, Mays Business School

- Nasser Chaudhry
- Miriam Camacho
- Neil Driscoll

---

## πŸ™ Acknowledgments

- OEM Manual Source: [CarManualsOnline.info](https://carmanualsonline.info)
- Embedding Model: [sentence-transformers/all-MiniLM-L6-v2](https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2)
- LLM: [Qwen/Qwen2.5-72B-Instruct](https://huggingface.co/Qwen/Qwen2.5-72B-Instruct)