File size: 4,087 Bytes
24f8de0
 
 
 
ca5d2cf
24f8de0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
---
title: Astra - Ayurvedic AI Assistant
emoji: 🌿
colorFrom: green
colorTo: green
sdk: docker
pinned: false
license: apache-2.0
app_port: 7860
---

# Astra - Your Ayurvedic AI Assistant 🌿

Meet Astra, an intelligent Ayurvedic AI Assistant powered by Llama 3.2 11B with specialized Ayurveda knowledge. Astra provides complete, thorough information about Ayurvedic medicine, herbs, wellness practices, and holistic health.

## What Makes Astra Special**Complete Responses**: Astra never gives partial answers - every response is thorough and comprehensive

🌿 **Ayurvedic Expertise**: Specialized knowledge about herbs, treatments, doshas, and traditional wellness

🤖 **Advanced AI**: Powered by Llama 3.2 11B with Ayurveda-specific LoRA adapters

📚 **Comprehensive Information**: Covers benefits, usage, precautions, and traditional wisdom

💡 **Clear Communication**: Complex Ayurvedic concepts explained in accessible language

## Features

- **Complete, thorough responses** - never incomplete or partial information
- **Ayurvedic knowledge base** covering herbs, treatments, and wellness practices
- **Dosha guidance** - personalized insights for Vata, Pitta, and Kapha
- **RESTful API** with FastAPI
- **Interactive documentation** via Swagger UI
- **Optimized for production** with 4-bit quantization

## Quick Start

### 1. View API Documentation

Visit the interactive docs:
- **Swagger UI**: [/docs](/docs)
- **ReDoc**: [/redoc](/redoc)

### 2. Check API Status

```bash
curl https://YOUR_USERNAME-YOUR_SPACE_NAME.hf.space/health
```

### 3. Chat with Astra

First, load the model:
```bash
curl -X POST https://YOUR_USERNAME-YOUR_SPACE_NAME.hf.space/load-model
```

Then ask Astra a question:
```bash
curl -X POST https://YOUR_USERNAME-YOUR_SPACE_NAME.hf.space/generate \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "What are the complete benefits and uses of Ashwagandha in Ayurveda?",
    "max_length": 1024,
    "temperature": 0.7
  }'
```

**Note**: Astra is configured to provide complete, thorough responses. The default `max_length` is 1024 tokens to ensure comprehensive answers.

## API Endpoints

| Method | Endpoint | Description |
|--------|----------|-------------|
| GET | `/` | API information |
| GET | `/health` | Health check |
| GET | `/status` | Model status |
| POST | `/load-model` | Load AI model |
| POST | `/generate` | Generate text |
| GET | `/docs` | Swagger UI |

## Models

- **Base**: `unsloth/llama-3.2-11b-vision-instruct-bnb-4bit`
- **LoRA**: `ayureasehealthcare/llama3-ayurveda-lora-v3`

## Request Parameters

### `/generate` endpoint:

```json
{
  "prompt": "Your question or prompt",
  "max_length": 1024,
  "temperature": 0.7,
  "top_p": 0.9,
  "top_k": 50
}
```

## Response Format

```json
{
  "generated_text": "AI-generated response...",
  "prompt": "Your original prompt",
  "model_info": {
    "assistant": "Astra - Ayurvedic AI Assistant",
    "base_model": "unsloth/Meta-Llama-3.1-8B-Instruct-bnb-4bit",
    "lora_model": "ayureasehealthcare/llama3-ayurveda-lora-v3",
    "parameters": {
      "max_length": 1024,
      "min_length": 100,
      "temperature": 0.7,
      "top_p": 0.9,
      "top_k": 50
    }
  }
}
```

## Example Use Cases

- Query Ayurvedic herb benefits
- Ask about traditional wellness practices
- Learn about doshas and body types
- Discover natural remedies
- Understand Ayurvedic nutrition

## Hardware

This Space runs on:
- **CPU Basic** (free tier) - for testing
- **Upgrade to GPU** recommended for production use

## Notes

⚠️ **First-time model loading**: The first request may take 10-30 minutes as the model downloads from Hugging Face. Subsequent requests will be much faster.

💡 **Tip**: For faster responses, consider upgrading to GPU hardware in Space settings.

## Tech Stack

- FastAPI
- Uvicorn
- PyTorch
- Transformers (Hugging Face)
- PEFT (LoRA adapters)
- Unsloth (optimized inference)

## Source Code

Full source code and documentation available in the repository.

## License

Apache 2.0

---

Built with ❤️ using Hugging Face Spaces