Spaces:
Build error
Build error
| echo "๐ง Fixing HF Space build issues..." | |
| # Copy fixed requirements | |
| if [ -f "requirements_fixed.txt" ]; then | |
| cp requirements_fixed.txt requirements.txt | |
| echo "โ Updated requirements.txt" | |
| else | |
| echo "โ requirements_fixed.txt not found" | |
| exit 1 | |
| fi | |
| # Copy app with data integration | |
| if [ -f "app_with_data.py" ]; then | |
| cp app_with_data.py app.py | |
| echo "โ Updated app.py" | |
| else | |
| echo "โ app_with_data.py not found" | |
| exit 1 | |
| fi | |
| # Create Dockerfile for HF Spaces | |
| cat > Dockerfile << 'EOF' | |
| FROM python:3.9 | |
| # Create user | |
| RUN useradd -m -u 1000 user | |
| # Set working directory | |
| WORKDIR /app | |
| # Copy requirements first for better caching | |
| COPY --chown=user ./requirements.txt requirements.txt | |
| # Install dependencies | |
| RUN pip install --no-cache-dir --upgrade -r requirements.txt | |
| # Create necessary directories | |
| RUN mkdir -p /app/data /app/templates /app/configs | |
| # Copy application files | |
| COPY --chown=user . /app | |
| # Switch to user | |
| USER user | |
| # Expose port | |
| EXPOSE 8080 | |
| # Run the application | |
| CMD ["python", "app.py"] | |
| EOF | |
| echo "โ Created Dockerfile" | |
| # Create README.md for HF Spaces | |
| cat > README.md << 'EOF' | |
| --- | |
| title: Textilindo AI Assistant | |
| emoji: ๐ค | |
| colorFrom: blue | |
| colorTo: purple | |
| sdk: docker | |
| pinned: false | |
| license: mit | |
| app_port: 8080 | |
| --- | |
| # Textilindo AI Assistant | |
| AI-powered customer service assistant for Textilindo textile company. | |
| ## Features | |
| - ๐ค **Smart AI Assistant**: Answers customer questions about products, shipping, and company policies | |
| - ๐ **Knowledge Base**: Uses 182+ training examples for context-aware responses | |
| - ๐ฎ๐ฉ **Indonesian Language**: Responds in friendly Indonesian language | |
| - ๐๏ธ **Sales Focus**: Helps customers with product recommendations and ordering | |
| ## API Endpoints | |
| - `GET /` - API documentation | |
| - `GET /health` - Health check | |
| - `POST /chat` - Chat with AI | |
| - `GET /stats` - Dataset statistics | |
| ## Usage | |
| Send a POST request to `/chat` with your message: | |
| ```json | |
| { | |
| "message": "dimana lokasi textilindo?", | |
| "max_tokens": 300, | |
| "temperature": 0.7 | |
| } | |
| ``` | |
| ## Dataset | |
| The assistant is trained on 182+ examples covering: | |
| - Company location and hours | |
| - Product information | |
| - Shipping and payment policies | |
| - Customer service scenarios | |
| ## Technology | |
| - **Backend**: Flask (Python) | |
| - **AI**: Hugging Face Transformers | |
| - **Data**: JSONL format with RAG (Retrieval-Augmented Generation) | |
| - **Deployment**: Hugging Face Spaces | |
| EOF | |
| echo "โ Created README.md" | |
| # Add and commit changes | |
| echo "๐ Committing changes..." | |
| git add . | |
| git commit -m "Fix build issues - remove problematic dependencies and add data integration | |
| - Remove difflib2 dependency (doesn't exist) | |
| - Use built-in difflib module instead | |
| - Add comprehensive dataset integration | |
| - Create proper Dockerfile for HF Spaces | |
| - Add README with documentation" | |
| # Push to Hugging Face Space | |
| echo "๐ Pushing to Hugging Face Space..." | |
| git push hf main | |
| echo "โ Build fix complete!" | |
| echo "" | |
| echo "๐ Next steps:" | |
| echo "1. Check your HF Space build status: https://huggingface.co/spaces/harismlnaslm/Textilindo" | |
| echo "2. Monitor the build logs" | |
| echo "3. Test your application once build completes" | |