Spaces:
Running
Running
Improve ReadMe
Browse files- README.md +87 -47
- frontend/README.md +0 -69
README.md
CHANGED
|
@@ -1,66 +1,106 @@
|
|
| 1 |
-
---
|
| 2 |
-
title: PromptAid Vision
|
| 3 |
-
emoji: π
|
| 4 |
-
colorFrom: blue
|
| 5 |
-
colorTo: red
|
| 6 |
-
sdk: docker
|
| 7 |
-
app_port: 7860
|
| 8 |
-
pinned: false
|
| 9 |
-
---
|
| 10 |
-
|
| 11 |
# PromptAid Vision
|
| 12 |
|
| 13 |
-
|
| 14 |
|
| 15 |
-
##
|
| 16 |
|
| 17 |
-
|
| 18 |
-
- **Unit Tests**: `frontend/src/test/unit_tests/` - Component and hook testing with Vitest
|
| 19 |
-
- **Integration Tests**: `frontend/src/test/integration/` - Component interaction testing
|
| 20 |
|
| 21 |
-
|
| 22 |
-
- **Unit Tests**: `py_backend/tests/unit_tests/` - Individual service testing
|
| 23 |
-
- **Integration Tests**: `py_backend/tests/integration_tests/` - API and workflow testing
|
| 24 |
|
| 25 |
-
|
| 26 |
-
- **
|
| 27 |
-
- **
|
|
|
|
|
|
|
| 28 |
|
| 29 |
## Quick Start
|
| 30 |
|
| 31 |
-
###
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
```bash
|
| 33 |
-
|
| 34 |
-
cd
|
| 35 |
-
|
| 36 |
-
npm run dev
|
| 37 |
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
```
|
| 43 |
|
| 44 |
-
|
|
|
|
| 45 |
```bash
|
| 46 |
-
#
|
| 47 |
-
cd
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
# E2E tests
|
| 56 |
-
cd e2e
|
| 57 |
-
./run_e2e_tests.sh
|
| 58 |
```
|
| 59 |
|
| 60 |
## Project Structure
|
|
|
|
| 61 |
```
|
| 62 |
-
βββ frontend/
|
| 63 |
-
βββ py_backend/
|
| 64 |
-
βββ e2e/
|
| 65 |
-
βββ .github/workflows/
|
| 66 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# PromptAid Vision
|
| 2 |
|
| 3 |
+
An AI-powered platform for crisis mapping and drone image analysis.
|
| 4 |
|
| 5 |
+
## Overview
|
| 6 |
|
| 7 |
+
PromptAid Vision combines multiple AI vision models (GPT-4V, Gemini, Hugging Face) to analyze imagery for crisis response and humanitarian mapping. The platform provides automated image analysis, metadata extraction, and comprehensive reporting capabilities.
|
|
|
|
|
|
|
| 8 |
|
| 9 |
+
## Architecture
|
|
|
|
|
|
|
| 10 |
|
| 11 |
+
- **Frontend**: React + TypeScript with Tailwind CSS
|
| 12 |
+
- **Backend**: FastAPI + Python with PostgreSQL
|
| 13 |
+
- **AI Models**: Multi-model support with intelligent fallbacks
|
| 14 |
+
- **Storage**: Flexible local/S3 storage with image processing
|
| 15 |
+
- **Testing**: Unit, integration, and E2E test coverage
|
| 16 |
|
| 17 |
## Quick Start
|
| 18 |
|
| 19 |
+
### Prerequisites
|
| 20 |
+
- Node.js 20+
|
| 21 |
+
- Python 3.11+
|
| 22 |
+
- PostgreSQL 16+
|
| 23 |
+
|
| 24 |
+
### Development Setup
|
| 25 |
+
|
| 26 |
+
1. **Backend**
|
| 27 |
+
```bash
|
| 28 |
+
cd py_backend
|
| 29 |
+
python -m venv .venv
|
| 30 |
+
source .venv/bin/activate # Windows: .venv\Scripts\activate
|
| 31 |
+
pip install -r requirements.txt
|
| 32 |
+
alembic upgrade head
|
| 33 |
+
uvicorn app.main:app --reload --port 7860
|
| 34 |
+
```
|
| 35 |
+
|
| 36 |
+
2. **Frontend**
|
| 37 |
+
```bash
|
| 38 |
+
cd frontend
|
| 39 |
+
npm install
|
| 40 |
+
npm run dev
|
| 41 |
+
```
|
| 42 |
+
|
| 43 |
+
3. **Access**
|
| 44 |
+
- Application: http://localhost:5173
|
| 45 |
+
- API: http://localhost:7860
|
| 46 |
+
- Documentation: http://localhost:7860/docs
|
| 47 |
+
|
| 48 |
+
## Deployment
|
| 49 |
+
|
| 50 |
+
### Local Production
|
| 51 |
```bash
|
| 52 |
+
cd frontend && npm run build
|
| 53 |
+
cd py_backend && uvicorn app.main:app --host 0.0.0.0 --port 7860
|
| 54 |
+
```
|
|
|
|
| 55 |
|
| 56 |
+
### Docker
|
| 57 |
+
```bash
|
| 58 |
+
docker-compose up --build
|
| 59 |
+
```
|
| 60 |
+
|
| 61 |
+
### Hugging Face Spaces
|
| 62 |
+
Automatically deployed via GitHub Actions workflow. Configure environment variables in Space settings.
|
| 63 |
+
|
| 64 |
+
## Environment Variables
|
| 65 |
+
|
| 66 |
+
```bash
|
| 67 |
+
DATABASE_URL=postgresql://user:password@localhost:5432/promptaid
|
| 68 |
+
STORAGE_PROVIDER=local # or s3
|
| 69 |
+
OPENAI_API_KEY=your-key
|
| 70 |
+
ANTHROPIC_API_KEY=your-key
|
| 71 |
+
GOOGLE_API_KEY=your-key
|
| 72 |
+
HUGGINGFACE_API_KEY=your-key
|
| 73 |
```
|
| 74 |
|
| 75 |
+
## Testing
|
| 76 |
+
|
| 77 |
```bash
|
| 78 |
+
# Backend
|
| 79 |
+
cd py_backend && python -m pytest tests/ -v
|
| 80 |
+
|
| 81 |
+
# Frontend
|
| 82 |
+
cd frontend && npm run test:unit
|
| 83 |
+
|
| 84 |
+
# E2E
|
| 85 |
+
cd e2e && ./run_e2e_tests.sh
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
```
|
| 87 |
|
| 88 |
## Project Structure
|
| 89 |
+
|
| 90 |
```
|
| 91 |
+
βββ frontend/ # React frontend
|
| 92 |
+
βββ py_backend/ # FastAPI backend
|
| 93 |
+
βββ e2e/ # End-to-end tests
|
| 94 |
+
βββ .github/workflows/ # CI/CD pipelines
|
| 95 |
```
|
| 96 |
+
|
| 97 |
+
## Contributing
|
| 98 |
+
|
| 99 |
+
1. Fork the repository
|
| 100 |
+
2. Create a feature branch
|
| 101 |
+
3. Add tests for new functionality
|
| 102 |
+
4. Submit a pull request
|
| 103 |
+
|
| 104 |
+
## License
|
| 105 |
+
|
| 106 |
+
MIT License
|
frontend/README.md
DELETED
|
@@ -1,69 +0,0 @@
|
|
| 1 |
-
# React + TypeScript + Vite
|
| 2 |
-
|
| 3 |
-
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
|
| 4 |
-
|
| 5 |
-
Currently, two official plugins are available:
|
| 6 |
-
|
| 7 |
-
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) for Fast Refresh
|
| 8 |
-
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
|
| 9 |
-
|
| 10 |
-
## Expanding the ESLint configuration
|
| 11 |
-
|
| 12 |
-
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
|
| 13 |
-
|
| 14 |
-
```js
|
| 15 |
-
export default tseslint.config([
|
| 16 |
-
globalIgnores(['dist']),
|
| 17 |
-
{
|
| 18 |
-
files: ['**/*.{ts,tsx}'],
|
| 19 |
-
extends: [
|
| 20 |
-
// Other configs...
|
| 21 |
-
|
| 22 |
-
// Remove tseslint.configs.recommended and replace with this
|
| 23 |
-
...tseslint.configs.recommendedTypeChecked,
|
| 24 |
-
// Alternatively, use this for stricter rules
|
| 25 |
-
...tseslint.configs.strictTypeChecked,
|
| 26 |
-
// Optionally, add this for stylistic rules
|
| 27 |
-
...tseslint.configs.stylisticTypeChecked,
|
| 28 |
-
|
| 29 |
-
// Other configs...
|
| 30 |
-
],
|
| 31 |
-
languageOptions: {
|
| 32 |
-
parserOptions: {
|
| 33 |
-
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
| 34 |
-
tsconfigRootDir: import.meta.dirname,
|
| 35 |
-
},
|
| 36 |
-
// other options...
|
| 37 |
-
},
|
| 38 |
-
},
|
| 39 |
-
])
|
| 40 |
-
```
|
| 41 |
-
|
| 42 |
-
You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
|
| 43 |
-
|
| 44 |
-
```js
|
| 45 |
-
// eslint.config.js
|
| 46 |
-
import reactX from 'eslint-plugin-react-x'
|
| 47 |
-
import reactDom from 'eslint-plugin-react-dom'
|
| 48 |
-
|
| 49 |
-
export default tseslint.config([
|
| 50 |
-
globalIgnores(['dist']),
|
| 51 |
-
{
|
| 52 |
-
files: ['**/*.{ts,tsx}'],
|
| 53 |
-
extends: [
|
| 54 |
-
// Other configs...
|
| 55 |
-
// Enable lint rules for React
|
| 56 |
-
reactX.configs['recommended-typescript'],
|
| 57 |
-
// Enable lint rules for React DOM
|
| 58 |
-
reactDom.configs.recommended,
|
| 59 |
-
],
|
| 60 |
-
languageOptions: {
|
| 61 |
-
parserOptions: {
|
| 62 |
-
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
| 63 |
-
tsconfigRootDir: import.meta.dirname,
|
| 64 |
-
},
|
| 65 |
-
// other options...
|
| 66 |
-
},
|
| 67 |
-
},
|
| 68 |
-
])
|
| 69 |
-
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|