File size: 3,015 Bytes
b1b57bb
 
 
 
 
 
 
 
 
 
9a3240f
b1b57bb
119d2a6
b1b57bb
119d2a6
b1b57bb
119d2a6
b1b57bb
119d2a6
b1b57bb
 
 
 
 
 
119d2a6
b1b57bb
119d2a6
b1b57bb
 
 
 
 
 
 
119d2a6
b1b57bb
119d2a6
b1b57bb
119d2a6
b1b57bb
 
 
 
 
 
 
 
 
 
 
119d2a6
 
b1b57bb
119d2a6
b1b57bb
119d2a6
 
b1b57bb
119d2a6
b1b57bb
119d2a6
 
b1b57bb
119d2a6
b1b57bb
119d2a6
 
b1b57bb
119d2a6
b1b57bb
119d2a6
 
b1b57bb
119d2a6
b1b57bb
 
 
 
 
 
119d2a6
b1b57bb
119d2a6
b1b57bb
 
 
 
 
119d2a6
b1b57bb
 
 
 
 
 
119d2a6
b1b57bb
 
119d2a6
 
b1b57bb
 
119d2a6
b1b57bb
 
119d2a6
 
b1b57bb
119d2a6
b1b57bb
 
 
 
 
119d2a6
4e69452
 
b1b57bb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
---
title: Textilindo AI Assistant
emoji: πŸ€–
colorFrom: blue
colorTo: green
sdk: docker
sdk_version: "4.0.0"
app_file: app.py
pinned: false
license: mit
short_description: AI Assistant for Textilindo textile company
---

# πŸ€– Textilindo AI Assistant

An intelligent AI assistant for Textilindo textile company with advanced training capabilities, built with FastAPI and Hugging Face Transformers.

## ✨ Features

- **Intelligent Chat Interface**: Natural language conversations in Indonesian
- **Company Knowledge**: Trained on Textilindo's specific information
- **Model Training**: Train custom models with your data
- **Fast Response**: Optimized for quick customer service
- **Mobile Friendly**: Responsive web interface
- **API Ready**: RESTful API for integration

## πŸš€ Quick Start

### Chat Interface
Visit the main page to start chatting with the AI assistant. Ask questions about:
- Company location and hours
- Product information
- Ordering and shipping
- Sample requests
- Pricing and terms

### Training API

#### Start Training
```bash
curl -X POST "https://harismlnaslm-Textilindo-AI.hf.space/api/train/start" \
  -H "Content-Type: application/json" \
  -d '{
    "model_name": "distilgpt2",
    "dataset_path": "data/lora_dataset_20250910_145055.jsonl",
    "config_path": "configs/training_config.yaml",
    "max_samples": 10,
    "epochs": 1,
    "batch_size": 1,
    "learning_rate": 5e-5
  }'
```

#### Check Training Status
```bash
curl "https://harismlnaslm-Textilindo-AI.hf.space/api/train/status"
```

#### Test Trained Model
```bash
curl -X POST "https://harismlnaslm-Textilindo-AI.hf.space/api/train/test"
```

#### Get Training Data Info
```bash
curl "https://harismlnaslm-Textilindo-AI.hf.space/api/train/data"
```

#### Check GPU Availability
```bash
curl "https://harismlnaslm-Textilindo-AI.hf.space/api/train/gpu"
```

## πŸ› οΈ Technical Details

### Architecture
- **Framework**: FastAPI with Uvicorn
- **AI Model**: Llama 3.1 8B Instruct (via Hugging Face)
- **Training**: PyTorch with Transformers
- **Language**: Indonesian (Bahasa Indonesia)
- **Deployment**: Docker on Hugging Face Spaces

### API Endpoints

#### Chat Endpoints
- `GET /` - Main chat interface
- `POST /chat` - Chat API endpoint
- `GET /health` - Health check
- `GET /info` - Application information

#### Training Endpoints
- `POST /api/train/start` - Start model training
- `GET /api/train/status` - Check training progress
- `GET /api/train/data` - Get training data information
- `GET /api/train/gpu` - Check GPU availability
- `POST /api/train/test` - Test trained model

### Environment Variables
Set these in your space settings:

```bash
# Required: Hugging Face API Key
HUGGINGFACE_API_KEY=your_api_key_here

# Optional: Model selection
DEFAULT_MODEL=meta-llama/Llama-3.1-8B-Instruct
```

## πŸ“ž Support

For technical issues:
1. Check the `/health` endpoint
2. Review space logs
3. Verify environment variables
4. Test with mock responses

---

*Built with ❀️ for Textilindo customers*