Hashii1729 commited on
Commit
2b94651
·
1 Parent(s): bb71884

Remove deprecated README and startup script; update FastAPI server port to 7860

Browse files
Files changed (4) hide show
  1. README copy.md +0 -162
  2. REFINED_PROMPT_README.md +0 -143
  3. fast.py +1 -1
  4. fastapi_startup_script.sh +0 -13
README copy.md DELETED
@@ -1,162 +0,0 @@
1
- # OutFitly API
2
-
3
- A FastAPI-based web application for outfit management and recommendations.
4
-
5
- ## Features
6
-
7
- - Fast and modern API built with FastAPI
8
- - Image processing capabilities with Pillow
9
- - Data validation with Pydantic
10
- - HTTP client functionality with requests
11
- - Automatic API documentation
12
-
13
- ## Prerequisites
14
-
15
- - Python 3.8 or higher
16
- - pip (Python package installer)
17
-
18
- ## Installation
19
-
20
- 1. **Clone the repository**
21
-
22
- ```bash
23
- git clone <repository-url>
24
- cd OutFitly
25
- ```
26
-
27
- 2. **Create a virtual environment**
28
-
29
- ```bash
30
- python -m venv ollama
31
-
32
- # On Windows
33
- ollama\Scripts\activate
34
-
35
- # On macOS/Linux
36
- source ollama/bin/activate
37
- ```
38
-
39
- 3. **Install dependencies**
40
- ```bash
41
- pip install -r fastapi_requirements.txt
42
- ```
43
-
44
- ## Usage
45
-
46
- ### Running the Development Server
47
-
48
- Start the FastAPI development server:
49
-
50
- ```bash
51
- uvicorn main:app --reload
52
- ```
53
-
54
- The API will be available at:
55
-
56
- - **API**: http://localhost:8000
57
- - **Interactive API docs (Swagger UI)**: http://localhost:8000/docs
58
- - **Alternative API docs (ReDoc)**: http://localhost:8000/redoc
59
-
60
- ### Running in Production
61
-
62
- For production deployment:
63
-
64
- ```bash
65
- uvicorn main:app --host 0.0.0.0 --port 8000
66
- ```
67
-
68
- ## API Documentation
69
-
70
- Once the server is running, you can access the interactive API documentation at:
71
-
72
- - Swagger UI: http://localhost:8000/docs
73
- - ReDoc: http://localhost:8000/redoc
74
-
75
- ## Project Structure
76
-
77
- ```
78
- OutFitly/
79
- ├── AI/
80
- │ ├── fastapi_requirements.txt
81
- │ └── [other AI-related files]
82
- ├── main.py # FastAPI application entry point
83
- ├── requirements.txt # Python dependencies
84
- ├── .gitignore # Git ignore rules
85
- └── README.md # This file
86
- ```
87
-
88
- ## Dependencies
89
-
90
- - **FastAPI** (0.104.1): Modern, fast web framework for building APIs
91
- - **Uvicorn** (0.24.0): ASGI server for running FastAPI applications
92
- - **Pillow** (10.0.1): Python Imaging Library for image processing
93
- - **Requests** (2.31.0): HTTP library for making API calls
94
- - **Pydantic** (2.4.2): Data validation and settings management
95
-
96
- ## Development
97
-
98
- ### Setting up Development Environment
99
-
100
- 1. Follow the installation steps above
101
- 2. Install additional development dependencies (if any):
102
- ```bash
103
- pip install pytest pytest-asyncio httpx
104
- ```
105
-
106
- ### Running Tests
107
-
108
- ```bash
109
- pytest
110
- ```
111
-
112
- ### Code Style
113
-
114
- This project follows PEP 8 style guidelines. You can check code style with:
115
-
116
- ```bash
117
- flake8 .
118
- ```
119
-
120
- ## Environment Variables
121
-
122
- Create a `.env` file in the root directory for environment-specific configurations:
123
-
124
- ```env
125
- # Example environment variables
126
- DEBUG=True
127
- DATABASE_URL=sqlite:///./app.db
128
- SECRET_KEY=your-secret-key-here
129
- ```
130
-
131
- ## Contributing
132
-
133
- 1. Fork the repository
134
- 2. Create a feature branch (`git checkout -b feature/amazing-feature`)
135
- 3. Commit your changes (`git commit -m 'Add some amazing feature'`)
136
- 4. Push to the branch (`git push origin feature/amazing-feature`)
137
- 5. Open a Pull Request
138
-
139
- ## License
140
-
141
- This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
142
-
143
- ## Support
144
-
145
- If you encounter any issues or have questions, please:
146
-
147
- 1. Check the [documentation](http://localhost:8000/docs) when the server is running
148
- 2. Search existing [issues](../../issues)
149
- 3. Create a new issue if needed
150
-
151
- ## Roadmap
152
-
153
- - [ ] Add authentication and authorization
154
- - [ ] Implement outfit recommendation algorithms
155
- - [ ] Add image upload and processing features
156
- - [ ] Create user management system
157
- - [ ] Add database integration
158
- - [ ] Implement caching layer
159
-
160
- ---
161
-
162
- **Built with ❤️ using FastAPI**
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
REFINED_PROMPT_README.md DELETED
@@ -1,143 +0,0 @@
1
- # Refined Clothing Analysis Prompt
2
-
3
- This document describes the refined prompt for analyzing clothing in images, providing a structured and comprehensive approach to fashion analysis.
4
-
5
- ## Overview
6
-
7
- The refined prompt has been integrated into the Fashion Analyzer API to provide structured clothing analysis that follows a consistent format. This ensures detailed, professional-quality fashion analysis suitable for various applications.
8
-
9
- ## API Endpoints
10
-
11
- ### 1. Structured Analysis Endpoint
12
- - **URL**: `POST /analyze-structured`
13
- - **Description**: Analyzes uploaded images using the refined structured format
14
- - **Response**: Returns analysis in the exact format specified by the refined prompt
15
-
16
- ### 2. Refined Prompt Endpoint
17
- - **URL**: `GET /refined-prompt`
18
- - **Description**: Returns the complete refined prompt specification
19
- - **Response**: Plain text containing the detailed prompt instructions
20
-
21
- ### 3. Traditional Analysis Endpoint
22
- - **URL**: `POST /analyze-image`
23
- - **Description**: Provides comprehensive fashion analysis with detailed insights
24
- - **Response**: Returns traditional detailed fashion analysis
25
-
26
- ## Refined Prompt Structure
27
-
28
- The refined prompt ensures analysis follows this exact structure:
29
-
30
- ### 1. UPPER GARMENT
31
- - **Type**: Specific garment classification (shirt, blouse, sweater, dress, etc.)
32
- - **Color**: Primary and secondary colors with color theory insights
33
- - **Material**: Fabric type with intelligent inference
34
- - **Features**: Distinguishing characteristics (patterns, buttons, sleeves, etc.)
35
-
36
- ### 2. LOWER GARMENT
37
- - **Type**: Bottom wear classification (jeans, pants, skirt, etc.)
38
- - **Color**: Color analysis with fashion context
39
- - **Material**: Fabric identification or intelligent inference
40
- - **Features**: Design elements (pockets, fit, length, etc.)
41
-
42
- ### 3. FOOTWEAR
43
- - **Type**: Shoe classification (sneakers, heels, boots, etc.)
44
- - **Color**: Color description and analysis
45
- - **Material**: Material identification
46
- - **Features**: Design details (laces, buckles, heel height, etc.)
47
-
48
- ### 4. OUTFIT SUMMARY
49
- A comprehensive 3-5 sentence paragraph that:
50
- - Describes overall aesthetic and style
51
- - Explains how pieces complement each other
52
- - Assesses occasion appropriateness and versatility
53
- - Includes color harmony analysis
54
- - Provides styling insights
55
-
56
- ## Key Features
57
-
58
- ### Intelligent Analysis
59
- - Uses yainage90 fashion-specific AI models for object detection
60
- - Provides intelligent inference when details aren't clearly visible
61
- - Incorporates color theory and fashion expertise
62
- - Considers fit, proportion, and styling principles
63
-
64
- ### Professional Terminology
65
- - Uses appropriate fashion vocabulary
66
- - Includes technical terms (silhouette, drape, texture)
67
- - Provides industry-standard assessments
68
- - Offers styling recommendations
69
-
70
- ### Comprehensive Coverage
71
- - Analyzes all visible clothing elements
72
- - Considers occasion appropriateness
73
- - Assesses versatility and styling potential
74
- - Provides color harmony insights
75
-
76
- ## Usage Examples
77
-
78
- ### Web Interface
79
- 1. Visit `http://localhost:7861`
80
- 2. Upload an image of clothing
81
- 3. Choose "Analyze Fashion (Structured)" for refined format
82
- 4. Choose "Analyze Fashion (Detailed)" for comprehensive analysis
83
-
84
- ### API Usage
85
- ```bash
86
- # Structured analysis
87
- curl -X POST "http://localhost:7861/analyze-structured" \
88
- -H "accept: application/json" \
89
- -H "Content-Type: multipart/form-data" \
90
- -F "file=@your_image.jpg"
91
-
92
- # Get refined prompt
93
- curl -X GET "http://localhost:7861/refined-prompt"
94
- ```
95
-
96
- ## Technical Implementation
97
-
98
- ### AI Models Used
99
- - **yainage90/fashion-object-detection**: Specialized fashion item detection
100
- - **yainage90/fashion-image-feature-extractor**: Fashion feature extraction
101
- - **Salesforce/blip-image-captioning-base**: Fallback image description
102
-
103
- ### Analysis Pipeline
104
- 1. Image preprocessing and validation
105
- 2. Fashion object detection using specialized models
106
- 3. Feature extraction and analysis
107
- 4. Intelligent inference for missing details
108
- 5. Structured output generation following refined prompt format
109
-
110
- ## Benefits
111
-
112
- ### Consistency
113
- - Standardized output format across all analyses
114
- - Predictable structure for integration with other systems
115
- - Professional-quality descriptions
116
-
117
- ### Accuracy
118
- - Specialized fashion AI models for better detection
119
- - Intelligent inference based on garment types
120
- - Color theory and fashion expertise integration
121
-
122
- ### Versatility
123
- - Suitable for e-commerce applications
124
- - Fashion blogging and content creation
125
- - Personal styling recommendations
126
- - Wardrobe analysis tools
127
-
128
- ## Future Enhancements
129
-
130
- - Integration with fashion trend databases
131
- - Seasonal styling recommendations
132
- - Brand and style recognition
133
- - Price point estimation
134
- - Sustainability assessments
135
-
136
- ## Getting Started
137
-
138
- 1. Start the server: `python fast.py`
139
- 2. Open browser to `http://localhost:7861`
140
- 3. Upload an image and select analysis type
141
- 4. View the refined prompt at `/refined-prompt`
142
-
143
- The refined prompt ensures consistent, professional fashion analysis suitable for various applications while maintaining the flexibility to provide detailed insights based on image content.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
fast.py CHANGED
@@ -2752,4 +2752,4 @@ async def deepfashion2_setup_instructions():
2752
  }
2753
 
2754
  if __name__ == "__main__":
2755
- uvicorn.run(app, host="0.0.0.0", port=7861)
 
2752
  }
2753
 
2754
  if __name__ == "__main__":
2755
+ uvicorn.run(app, host="0.0.0.0", port=7860)
fastapi_startup_script.sh DELETED
@@ -1,13 +0,0 @@
1
- #!/bin/bash
2
-
3
- # Debug: Check current user and permissions
4
- echo "Current user: $(whoami)"
5
- echo "Home directory: $HOME"
6
-
7
- # Note: This script is deprecated as the application now uses transformers instead of Ollama
8
- echo "Starting FastAPI server with transformers-based fashion analysis..."
9
-
10
- # Start FastAPI on port 7860 (HF Spaces requirement)
11
- echo "Starting FastAPI server on port 7860..."
12
- cd /app
13
- python3 -m uvicorn fast:app --host 0.0.0.0 --port 7860