pythonprincess commited on
Commit
247b822
·
verified ·
1 Parent(s): 6c869c0

Delete README.md

Browse files
Files changed (1) hide show
  1. README.md +0 -341
README.md DELETED
@@ -1,341 +0,0 @@
1
- # 🤖 PENNY - Civic Engagement AI Assistant
2
-
3
- **Personal civic Engagement Nurturing Network sYstem**
4
-
5
- [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
6
- [![Hugging Face](https://img.shields.io/badge/🤗-Hugging%20Face-yellow.svg)](https://huggingface.co/)
7
- [![FastAPI](https://img.shields.io/badge/FastAPI-0.100+-green.svg)](https://fastapi.tiangolo.com/)
8
- [![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
9
-
10
- ---
11
-
12
- ## 📋 Overview
13
-
14
- **PENNY** is a production-grade, AI-powered civic engagement assistant designed to help citizens connect with local government services, community events, and civic resources. This Hugging Face model provides the core orchestration engine that coordinates multiple specialized AI models to deliver warm, helpful, and contextually-aware assistance for civic participation.
15
-
16
- ### ✨ Key Features
17
-
18
- - **🏛️ Civic Information**: Local government services, voting info, public meetings
19
- - **📅 Community Events**: Real-time local events discovery and recommendations
20
- - **🌤️ Weather Integration**: Context-aware weather updates with outfit suggestions
21
- - **🌍 Multi-language Support**: Translation services for inclusive access
22
- - **🛡️ Safety & Bias Detection**: Built-in content moderation and bias analysis
23
- - **🔒 Privacy-First**: PII sanitization and secure logging
24
- - **⚡ High Performance**: Async architecture with intelligent caching
25
-
26
- ---
27
-
28
- ## 🧠 Model Architecture
29
-
30
- PENNY is a **multi-model orchestration system** that coordinates 5 specialized models:
31
-
32
- 1. **Gemma** - Core language understanding and response generation
33
- 2. **LayoutLM** - Document processing and civic resource extraction
34
- 3. **Sentiment Analysis Model** - Emotion detection and empathetic responses
35
- 4. **Bias Detection Model** - Content moderation and fairness checking
36
- 5. **Translation Model** - Multi-language support for inclusive access
37
-
38
- The orchestrator intelligently routes queries to the appropriate models and synthesizes their outputs into cohesive, helpful responses.
39
-
40
- ---
41
-
42
- ## 🚀 Quick Start
43
-
44
- ### Using the Hugging Face Inference API
45
-
46
- ```python
47
- from huggingface_hub import InferenceClient
48
-
49
- client = InferenceClient(model="your-username/penny-v2", token="your_hf_token")
50
-
51
- response = client.post(
52
- json={
53
- "inputs": "What community events are happening this weekend?",
54
- "tenant_id": "norfolk",
55
- "user_id": "user123",
56
- "session_id": "session456"
57
- }
58
- )
59
-
60
- print(response)
61
- ```
62
-
63
- ### Using with Python Requests
64
-
65
- ```python
66
- import requests
67
-
68
- API_URL = "https://api-inference.huggingface.co/models/your-username/penny-v2"
69
- headers = {"Authorization": f"Bearer {YOUR_HF_TOKEN}"}
70
-
71
- def query(payload):
72
- response = requests.post(API_URL, headers=headers, json=payload)
73
- return response.json()
74
-
75
- output = query({
76
- "inputs": "Tell me about voter registration",
77
- "tenant_id": "norfolk"
78
- })
79
- ```
80
-
81
- ### Response Format
82
-
83
- ```json
84
- {
85
- "response": "Hi! Here are some great community events happening this weekend in Norfolk...",
86
- "intent": "community_events",
87
- "tenant_id": "norfolk",
88
- "session_id": "session456",
89
- "timestamp": "2025-11-26T10:30:00Z",
90
- "response_time_ms": 245
91
- }
92
- ```
93
-
94
- ---
95
-
96
- ## 🏗️ Model Structure
97
-
98
- ```
99
- penny-v2/
100
- ├── app/ # Core application logic
101
- │ ├── orchestrator.py # Central coordination engine ⭐
102
- │ ├── model_loader.py # ML model management
103
- │ ├── intents.py # Intent classification
104
- │ ├── tool_agent.py # Civic data & events agent
105
- │ ├── weather_agent.py # Weather & recommendations
106
- │ └── utils/ # Logging, location, safety utilities
107
- ├── models/ # ML model services
108
- │ ├── translation/ # Multi-language translation
109
- │ ├── sentiment/ # Sentiment analysis
110
- │ ├── bias/ # Bias detection
111
- │ ├── gemma/ # Core LLM
112
- │ └── layoutlm/ # Document understanding
113
- ├── data/ # Civic resources & training data
114
- │ ├── civic_pdfs/ # Local government documents
115
- │ ├── events/ # Community events data
116
- │ ├── resources/ # Civic resource database
117
- │ └── embeddings/ # Pre-computed embeddings
118
- ├── handler.py # Hugging Face inference handler
119
- ├── model_config.json # Model configuration
120
- └── requirements.txt # Python dependencies
121
- ```
122
-
123
- ---
124
-
125
- ## 🔧 Configuration
126
-
127
- ### Model Parameters
128
-
129
- The orchestrator supports the following input parameters:
130
-
131
- | Parameter | Type | Description | Required | Default |
132
- |-----------|------|-------------|----------|---------|
133
- | `inputs` | string | User's message/query | Yes | - |
134
- | `tenant_id` | string | City/region identifier | No | `default` |
135
- | `user_id` | string | User identifier for tracking | No | `anonymous` |
136
- | `session_id` | string | Conversation session ID | No | Auto-generated |
137
- | `language` | string | Preferred response language | No | `en` |
138
-
139
- ### Environment Variables
140
-
141
- For self-hosted deployments, configure:
142
-
143
- | Variable | Description | Required |
144
- |----------|-------------|----------|
145
- | `AZURE_MAPS_KEY` | Azure Maps API key (weather) | Recommended |
146
- | `LOG_LEVEL` | Logging level (`INFO`, `DEBUG`) | No |
147
- | `TENANT_ID` | Default tenant/city | No |
148
-
149
- ---
150
-
151
- ## 🎯 Use Cases
152
-
153
- ### Civic Information Queries
154
- ```python
155
- query({"inputs": "How do I register to vote in Norfolk?"})
156
- query({"inputs": "When is the next city council meeting?"})
157
- ```
158
-
159
- ### Community Events
160
- ```python
161
- query({"inputs": "What events are happening this weekend?"})
162
- query({"inputs": "Are there any family-friendly activities nearby?"})
163
- ```
164
-
165
- ### Weather & Recommendations
166
- ```python
167
- query({"inputs": "What's the weather like today?"})
168
- query({"inputs": "Should I bring an umbrella tomorrow?"})
169
- ```
170
-
171
- ### Multi-language Support
172
- ```python
173
- query({
174
- "inputs": "¿Cómo registro para votar?",
175
- "language": "es"
176
- })
177
- ```
178
-
179
- ---
180
-
181
- ## 🔌 Integration Guide
182
-
183
- ### Backend Integration (Azure)
184
-
185
- PENNY is designed to work seamlessly with Azure backend services:
186
-
187
- ```python
188
- # Azure Function integration example
189
- import azure.functions as func
190
- from huggingface_hub import InferenceClient
191
-
192
- def main(req: func.HttpRequest) -> func.HttpResponse:
193
- client = InferenceClient(model="your-username/penny-v2")
194
-
195
- user_message = req.params.get('message')
196
- tenant = req.params.get('tenant_id', 'default')
197
-
198
- response = client.post(json={
199
- "inputs": user_message,
200
- "tenant_id": tenant
201
- })
202
-
203
- return func.HttpResponse(
204
- response.json(),
205
- mimetype="application/json"
206
- )
207
- ```
208
-
209
- ### Frontend Integration (Lovable)
210
-
211
- Connect to PENNY from your Lovable frontend:
212
-
213
- ```javascript
214
- // Lovable component example
215
- async function askPenny(message, tenantId) {
216
- const response = await fetch(
217
- 'https://api-inference.huggingface.co/models/your-username/penny-v2',
218
- {
219
- headers: {
220
- 'Authorization': `Bearer ${HF_TOKEN}`,
221
- 'Content-Type': 'application/json'
222
- },
223
- method: 'POST',
224
- body: JSON.stringify({
225
- inputs: message,
226
- tenant_id: tenantId
227
- })
228
- }
229
- );
230
-
231
- return await response.json();
232
- }
233
- ```
234
-
235
- ---
236
-
237
- ## 📊 Model Performance
238
-
239
- - **Average Response Time**: 200-400ms
240
- - **Intent Classification Accuracy**: 94%
241
- - **Multi-language Support**: 50+ languages
242
- - **Concurrent Requests**: Scales with Hugging Face Pro tier
243
- - **Uptime**: 99.9% (via Hugging Face infrastructure)
244
-
245
- ---
246
-
247
- ## 🛡️ Safety & Privacy
248
-
249
- - **PII Protection**: All logs sanitized before storage
250
- - **Content Moderation**: Built-in bias and safety detection
251
- - **Bias Scoring**: Real-time fairness evaluation
252
- - **Privacy-First**: No user data stored by the model
253
- - **Compliance**: Designed for government/public sector use
254
-
255
- ---
256
-
257
- ## 🧪 Testing & Validation
258
-
259
- ### Test the Model
260
-
261
- ```python
262
- # Basic functionality test
263
- test_queries = [
264
- "What's the weather today?",
265
- "How do I pay my water bill?",
266
- "Are there any events this weekend?",
267
- "Translate: Hello, how are you? (to Spanish)"
268
- ]
269
-
270
- for query in test_queries:
271
- response = client.post(json={"inputs": query})
272
- print(f"Query: {query}")
273
- print(f"Response: {response}\n")
274
- ```
275
-
276
- ---
277
-
278
- ## 📦 Dependencies
279
-
280
- Core dependencies (see `requirements.txt` for full list):
281
- - `transformers>=4.30.0`
282
- - `torch>=2.0.0`
283
- - `fastapi>=0.100.0`
284
- - `pydantic>=2.0.0`
285
- - `azure-ai-ml>=1.8.0`
286
- - `sentence-transformers>=2.2.0`
287
-
288
- ---
289
-
290
- ## 🤝 Contributing
291
-
292
- We welcome contributions! Areas for improvement:
293
- - New civic data sources
294
- - Additional language support
295
- - Enhanced intent classification
296
- - Performance optimizations
297
-
298
- ---
299
-
300
- ## 🗺️ Roadmap
301
-
302
- - [ ] Voice interface integration
303
- - [ ] Advanced sentiment analysis
304
- - [ ] Predictive civic engagement insights
305
- - [ ] Mobile app SDK
306
- - [ ] Real-time event streaming
307
-
308
- ---
309
-
310
- ## 📝 Citation
311
-
312
- If you use PENNY in your research or application, please cite:
313
-
314
- ```bibtex
315
- @software{penny_civic_ai,
316
- title={PENNY: Personal Civic Engagement Nurturing Network System},
317
- author={Your Name/Organization},
318
- year={2025},
319
- url={https://huggingface.co/pythonprincessssss/penny-v2}
320
- }
321
- ```
322
-
323
- ---
324
-
325
- ## 📞 Support
326
-
327
- - **Issues**: [GitHub Issues](https://github.com/CyberShawties-LLC/penny-v2/issues)
328
- - **Hugging Face Discussions**: Use the Community tab
329
- - **Email**:
330
-
331
- ---
332
-
333
- ## 📄 License
334
-
335
- This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
336
-
337
- ---
338
-
339
- **Made with ❤️ for civic engagement**
340
-
341
- *Empowering communities through accessible AI assistance*