Project Info
Inspiration
Fast fashion contributes to unethical labor practices and environmental damage, yet it remains hard for consumers to identify which brands are sustainable. We wanted to make ethical awareness easy as taking a photo. BeWear was inspired by the idea of merging visual recognition and AI-driven transparency to empower everyday consumers to make responsible choices.
What it does
BeWear allows users to snap a picture of any branded textile or clothing item (or manually enter the brand). The app then detects the brand from the image and retrieves an "ethical score" that is calculated using different variables representing the brand's sourcing, labor, environmental impact, transparency, and more. BeWear gives you an in-depth summary of the variables that went into calculating the "ethical score", and users have the option to use an agent to scrape for real-time events related to greenwashing.
How we built it
Frontend: Vanilla JS Data Layer: Elastisearch single index, fuzzy matching, typo tolerance, >6000 brands ingested from scraped data Backend: Python SerpAPI(Google Lens API) for Visual brand identification ImgBB for image hosting for google Lens analysis Anthropic (Claude) API for brand extraction, analysis, and use in agent LangGraph for agent workflow orchestration for greenwashing investigation Tavily API for AI optimized web search SSE: real-time status streaming to frontend Agent decision logic ##
Challenges we ran into
LangGraph state management: there was a bug where part of the state (articles and their respective links) was not mapping correctly, and the agent kept going to the same links. Scraping through 6000+ pages: populating the database with every single brand in the good on you website (essentially we create a MCP for good on you API) ##
Accomplishments we're proud of
Completed a database of 6000+ brands Easy-to-use UI AI Powered Greenwashing detection ##
What we learned
We learned how to manage stress under high constraints We learned how to fully integrate front and back end We learned how to obtain real-time updates using SSE We learned how to work efficiently by dividing work within the team ##
What's next
We will turn BeWear into a browser extension allow it to assist the user during shopping User reviews ML Based similar brand detection
BeWear - Ethical Fashion Intelligence Platform
A full-stack AI-powered platform that analyzes fashion brands for ethical practices, identifies greenwashing claims, and empowers consumers to make informed fashion choices.
Live brand analysis in seconds. AI-powered. No greenwashing.
What is BeWear?
BeWear provides instant ethical analysis of fashion brands using three methods:
- Text Search - Search by brand name (Nike, Zara, H&M, etc.)
- Image Upload - Upload a product photo and we'll identify the brand and analyze it
- Camera Capture - Snap a photo in-app of any fashion item
- Greenwashing Detection - Investigate if a brand is making false ethical claims
Sample Analysis
Input: "Nike"
Output:
{
"brand_name": "Nike",
"overall_score": 75.5,
"rating": "Good",
"labor_score": 70.0,
"environmental_score": 80.0,
"transparency_score": 76.0,
"supply_chain_score": 75.0,
"certifications": ["Fair Trade", "GOTS"],
"analysis": "Nike shows commitment to labor standards with documented policies for fair wages and worker safety. Their environmental efforts focus on sustainable materials and water reduction. However, transparency could be improved in supply chain disclosure..."
}
Key Features
- β‘ Instant Analysis - Get ethical scores within 2-3 seconds
- πΈ Image Recognition - Identify brands from product photos using Google Lens
- π€ AI-Powered Insights - Claude AI explains ethical practices in natural language
- π Greenwashing Detection - Investigates false environmental claims with web search
- π Comprehensive Scoring - Labor, environmental, transparency, and supply chain metrics
- π― Autocomplete - Real-time brand search suggestions
- π± Mobile Responsive - Works on phones, tablets, and desktops
- π Real-time Updates - Live status streaming for long-running investigations
Technology Stack
Backend
- Framework: FastAPI + Uvicorn (Python 3.11)
- Database: Elasticsearch 8.11.1+ (local or cloud)
- AI: Claude API (Anthropic) - Sonnet 3.5 for analysis, Haiku for quick tasks
- Search: Tavily API (greenwashing investigation)
- Vision: Google Lens via SerpAPI (image identification)
- Streaming: SSE (Server-Sent Events) for real-time updates
Frontend
- Framework: Vanilla JavaScript (no build step)
- Styling: Tailwind CSS
- Icons: Font Awesome 6.5.1
- Features: Tab-based UI, drag-and-drop upload, camera streaming
DevOps
- Containerization: Docker & Docker Compose
- Package Management: uv (Python)
- Environment: Python venv
Quick Start
1. Prerequisites
- Docker and Docker Compose
- Python 3.11+
- API Keys:
ANTHROPIC_API_KEY- Get from Anthropic ConsoleTAVILY_API_KEY- Get from Tavily (for greenwashing detection)SERP_API_KEY(optional) - Get from SerpAPI for image analysisIMGBB_API_KEY(optional) - Get from ImgBB API for image hosting
2. Setup
# Clone the repository
git clone https://github.com/haribary/ethical-source.git
cd ethical-source
# Start Elasticsearch
docker-compose up -d
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
cd backend_fastAPI
pip install -r requirements.txt
# Configure environment
cp .env.example .env
# Edit .env with your API keys
# Ingest sample data
python ingest_data.py
# Start backend server
python main.py
# Server runs on http://localhost:8000
3. Open Frontend
Open frontend/index.html in your browser, or serve it:
cd frontend
python -m http.server 8080
# Open http://localhost:8080 in your browser
API Endpoints
Text Analysis
POST /analyze/text
Content-Type: application/json
{"brand_name": "nike"}
Returns: Brand ethical analysis with scores, certifications, and AI insights
Image Analysis
POST /analyze/image
Content-Type: multipart/form-data
file: <image file>
Returns: Brand analysis + Google Lens identified products
Autocomplete/Search
GET /autocomplete?q=nik&limit=10
Returns: Brand suggestions with ratings
Greenwashing Investigation (Server-Sent Events)
POST /analyze/greenwashing
Content-Type: application/json
{"brand_name": "nike"}
Streams real-time status updates, then returns:
- Greenwashing risk flag (LOW/MEDIUM/HIGH)
- Summary of findings
- Top articles with citations
- Relevance scores
Health Check
GET /health
Architecture Overview
Data Flow - Text Analysis
User Input (Brand Name)
β
Elasticsearch (Fuzzy Search)
β
Brand Data Retrieved
β
Claude AI (Analysis Generation)
β
Formatted Response
β
Frontend Display
Data Flow - Image Analysis
User Upload (Image)
β
Image Validation & Upload to ImgBB
β
Google Lens (Product Identification)
β
Claude Extracts Brand Name
β
Elasticsearch Search
β
Claude Analysis
β
Response with Google Lens Results
Data Flow - Greenwashing Detection
Brand Name
β
Stream Status: "Looking up brand..."
β
Elasticsearch Lookup
β
Stream Status: "Initializing AI agent..."
β
LangGraph Agent Creates 3 Search Queries
β
Stream Status: "Searching news sources..."
β
Tavily Web Search (Top 10 Results)
β
Stream Status: "Analyzing articles..."
β
Claude Analyzes Each Article
β
Stream Status: "Evaluating greenwashing risk..."
β
Rank by Relevance + Flag (LOW/MEDIUM/HIGH)
β
Stream Final Result
Data Model
Elasticsearch Index: ethical_brands
{
"name": "Nike",
"official_name": "Nike, Inc.",
"overall_score": 75.5,
"labor_rights_score": 70.0,
"environmental_impact_score": 80.0,
"transparency_score": 76.0,
"supply_chain_ethics_score": 75.0,
"rating_tier": "Good",
"certifications": ["Fair Trade", "GOTS"],
"metrics": [
{
"metric_id": "labor-001",
"metric_name": "Fair Wages",
"category": "labor_rights",
"score": 70.5,
"weight": 2.0,
"description": "Assessment of fair wages practices"
}
]
}
Project Structure
ethical_src/
βββ backend_fastAPI/
β βββ main.py # FastAPI application (818 lines)
β βββ greenwashing_agent.py # LangGraph-based agent (407 lines)
β βββ ingest_data.py # Sample data ingestion
β βββ requirements.txt # Python dependencies
β βββ .env # Configuration (create from .env.example)
β βββ start.sh # Quick start script
β βββ README.md # Backend documentation
β βββ QUICK_START.md # Quick reference
β
βββ frontend/
β βββ index.html # Main UI
β βββ app.js # JavaScript logic
β βββ package.json # Frontend metadata
β
βββ docker-compose.yml # Elasticsearch setup
βββ LICENSE # MIT License
Development
Backend Development
cd backend_fastAPI
source venv/bin/activate
# Run with auto-reload
python main.py
# Run tests
python test_startup.py
# Example usage
python example_usage.py
Frontend Development
No build step needed. Just edit files and refresh browser:
index.html- UI structure and stylingapp.js- JavaScript logic and API calls
Adding New Brands
Edit backend_fastAPI/ingest_data.py and add brands to the sample data:
brands = [
{
"_id": "mybrand-001",
"name": "MyBrand",
"official_name": "MyBrand Inc.",
"overall_score": 85.0,
# ... other fields
}
]
Then re-ingest:
python ingest_data.py
Configuration
Environment Variables
Create .env in backend_fastAPI/:
# Required
ANTHROPIC_API_KEY=sk-ant-your-key
TAVILY_API_KEY=your-tavily-key
# Elasticsearch
ELASTICSEARCH_HOST=http://localhost:9200
ELASTICSEARCH_USER=elastic
ELASTICSEARCH_PASSWORD=password
# Optional (for image analysis)
SERP_API_KEY=your-serp-key
IMGBB_API_KEY=your-imgbb-key
CORS Settings
Update CORS allowed origins in backend_fastAPI/main.py:
app.add_middleware(
CORSMiddleware,
allow_origins=["http://localhost:3000", "https://yourdomain.com"],
)
Performance
Latency Expectations
- Text Analysis: ~2-3 seconds
- Image Analysis: ~8-10 seconds
- Greenwashing Investigation: ~15-20 seconds
Optimization Tips
- Cache popular brands with Redis
- Use Claude streaming for faster perceived latency
- Parallel process Google Lens + ImgBB uploads
- Preload top 100 brands in memory
Security & Deployment
Before Production
- Restrict CORS to specific domains
- Implement rate limiting
- Add file size validation (e.g., 5MB max)
- Set up HTTPS
- Enable database authentication
- Add request logging/monitoring
- Configure error tracking (Sentry)
- Implement API key rotation
Docker Deployment
# Build
docker build -t bewear-backend backend_fastAPI/
# Run
docker run -p 8000:8000 \
-e ANTHROPIC_API_KEY=your-key \
-e ELASTICSEARCH_HOST=elasticsearch:9200 \
bewear-backend
Troubleshooting
"Brand not found"
# Check Elasticsearch is running
curl http://localhost:9200
# Verify data is ingested
python backend_fastAPI/ingest_data.py
# Check index exists
curl http://localhost:9200/ethical_brands/_count
"IMGBB_API_KEY not configured"
Image analysis requires ImgBB:
- Get free key at https://api.imgbb.com/
- Add to
.env:IMGBB_API_KEY=your-key
"Google Lens failed"
- Verify
SERP_API_KEYin.env - Check SerpAPI account has credits
- Ensure image is in public format
Module not found
cd backend_fastAPI
source venv/bin/activate
pip install -r requirements.txt
API Response Examples
Text Analysis Response
{
"brand_name": "Nike",
"detection_method": "text_input",
"google_lens_titles": null,
"analysis": "Nike scores 75.5/100 on our ethical scale. Strengths: They have documented labor standards and are transitioning to sustainable materials. Weaknesses: Supply chain transparency needs improvement, and worker wages remain below living wage in some regions.",
"overall_score": 75.5,
"rating": "Good",
"labor_score": 70.0,
"environmental_score": 80.0,
"transparency_score": 76.0,
"supply_chain_score": 75.0,
"certifications": ["Fair Trade", "GOTS"],
"analyzed_at": "2025-01-15T10:30:00Z"
}
Greenwashing Response
{
"flagged": true,
"flag_level": "MEDIUM",
"summary": "Found evidence of selective environmental claims without full context on labor practices",
"total_articles_found": 23,
"articles": [
{
"title": "Brand's 'Eco-Friendly' Claims Draw Scrutiny",
"url": "https://example.com/article",
"published_date": "2024-12-15",
"greenwashing_type": "selective_transparency",
"evidence": "Claims 100% renewable materials but doesn't disclose water usage",
"why_matters": "Consumers misled about full environmental impact",
"relevance_score": 0.95
}
]
}
Contributing
Contributions welcome! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open a Pull Request
Recent Updates
- Fixed JSON parsing in greenwashing agent
- Improved top 10 results consistency
- Added real-time status updates via Server-Sent Events
- Enhanced UI with live progress indicators
- Single Elasticsearch index for simplified architecture
See CHANGES_SUMMARY.md for details.
Future Roadmap
Phase 1 (Quick Wins)
- Brand comparison endpoint
- Redis caching for popular brands
- Analytics dashboard
Phase 2 (Enhanced UX)
- User accounts and saved searches
- User reviews and ratings
- Alternative brand recommendations
Phase 3 (Advanced)
- ML-based similar brand detection
- Sustainability predictions
- Real-time brand score updates
Support & Documentation
- Quick Start: See backend_fastAPI/QUICK_START.md
- Architecture: See backend_fastAPI/ARCHITECTURE.md
- Backend Docs: See backend_fastAPI/README.md
- Issues: Report bugs via GitHub Issues
- API Tests: See backend_fastAPI/example_usage.py
License
MIT License - see LICENSE file for details
Data Attribution
Ethical ratings based on data from:
- Good On You: Independent ethical fashion ratings
- Tavily: Web search for greenwashing investigations
- Google Lens: Product identification
- Claude AI: Analysis and recommendations
Author
Created by
Make ethical fashion choices. One brand at a time.
For questions, feedback, or partnership opportunities, open an issue or contact the maintainer.
Analysis
View
Metric
- 15
- 11
- 3
- 3
Figures cover GitHub contributors during the hackathon window. A co-authored commit counts in full for each author, so per-member totals add up to more than the whole-team figures.
Technology
- AnthropicIn code
- FastAPIIn code
- HTMLIn code
- JavaScriptIn code
- PythonIn code
- LangChainClaimed
5 of 6 appear in the indexed code. 1 claimed on Devpost could not be matched to code, which may simply mean the tool leaves no trace in the repository.
AI coding agents
No AI coding agent signals were found in this repository.
Detected from committed agent config files and commit authorship. Absence of a signal is not proof an agent was unused.
Codebase size
Source size
190 KB
Source files
20
Counts recognized source files only; vendored directories, binaries and lockfiles are excluded, so this is smaller than the repository on disk.
Repository
haribary/ethical-source
25 files Β· 201 KB Β· @ 0d87d39
Structure
Interface
2 files Β· 8%Screens, components and styles rendered to the user.
Application logic
13 files Β· 52%Domain rules, services and shared utilities.
Supporting
Layers are inferred from where files sit in the tree, not from reading the code. A project that names its directories unconventionally will read oddly here β open the file browser to check anything the diagram implies.
Languages
- Python39%
- Markdown23%
- HTML23%
- JavaScript15%
- Shell0%
- YAML0%
Share of indexed source by file size. Binary and vendored files are excluded.
Dependencies
backend_fastAPI/requirements.txt
pypi Β· 19- anthropic
- elasticsearch[async]
- fastapi
- google-search-results
- httpx
- langchain-anthropic
- langgraph
- Pillow
- pydantic
- pydantic-settings
- pytest
- pytest-asyncio
- python-dotenv
- python-json-logger
- python-multipart
- requests
- sse-starlette
- tavily-python
- +1 more
Declared in the repositoryβs manifests at the indexed commit. A declared package is not proof it is used, and runtime dependencies are listed first.
This projectβs features have not been analysed yet.
Export this project's context (description, README, evidence, key source files) to chat with an AI agent elsewhere.