File size: 3,410 Bytes
a33b0e1
 
 
 
c02fe07
a33b0e1
 
c02fe07
 
 
 
 
 
 
 
 
a33b0e1
c02fe07
85cb7be
c02fe07
a33b0e1
9b006e9
c02fe07
a33b0e1
c02fe07
a33b0e1
c02fe07
a33b0e1
c02fe07
 
 
 
 
 
a33b0e1
c02fe07
a33b0e1
c02fe07
 
 
 
 
 
a33b0e1
c02fe07
a33b0e1
c02fe07
 
 
 
 
a33b0e1
c02fe07
a33b0e1
c02fe07
 
 
 
 
a33b0e1
c02fe07
 
a33b0e1
c02fe07
 
 
a33b0e1
c02fe07
 
 
9b006e9
c02fe07
9b006e9
c02fe07
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9b006e9
 
c02fe07
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a33b0e1
c02fe07
a33b0e1
 
f104fee
c02fe07
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
---
title: Web3 Research Co-Pilot
emoji: πŸš€
colorFrom: blue
colorTo: green
sdk: docker
app_file: app.py
dockerfile: Dockerfile
license: mit
tags:
- cryptocurrency
- blockchain
- defi
- ai-research
- ollama
- llama3
pinned: false
header: default
short_description: AI-powered crypto research with real-time blockchain data
suggested_hardware: t4-medium
---

# Web3 Research Co-Pilot πŸš€

An AI-powered cryptocurrency research assistant that provides real-time blockchain analytics, DeFi insights, and market intelligence using Llama 8B and comprehensive API integrations.

## ✨ Features

- **πŸ€– AI-Powered Analysis**: Uses Llama 8B model via Ollama for intelligent responses
- **πŸ”— Real-Time Data**: Integrates with CryptoCompare, DeFiLlama, Etherscan APIs
- **πŸ›‘οΈ AI Safety**: Built-in content filtering and safety guardrails
- **πŸ“Š Interactive UI**: Modern web interface with dark/light themes
- **⚑ Streaming Responses**: Real-time progress updates during analysis
- **πŸ”„ Comprehensive Tools**: 5+ specialized cryptocurrency research tools

## πŸ› οΈ Technical Stack

- **Backend**: FastAPI with Python 3.11
- **AI Model**: Llama 3 8B via Ollama (local inference)
- **Frontend**: Vanilla JavaScript with modern CSS
- **APIs**: CryptoCompare, DeFiLlama, Etherscan, CoinGecko
- **Safety**: Custom AI safety module with content filtering
- **Deployment**: Docker for HuggingFace Spaces

## πŸš€ Usage

Ask questions like:
- "Analyze Bitcoin price trends and institutional adoption patterns"
- "Compare top DeFi protocols by TVL and yield metrics"
- "What are the current Ethereum gas fees?"
- "Track whale movements in Bitcoin today"

## πŸ”§ Development

### Local Setup
```bash
# Clone the repository
git clone https://huggingface.co/spaces/your-username/web3-research-copilot
cd web3-research-copilot

# Install dependencies
pip install -r requirements.txt

# Start Ollama (in separate terminal)
ollama serve
ollama pull llama3:8b

# Run the application
python app.py
```

### Docker Deployment
```bash
# Build and run with Docker
docker build -f Dockerfile.hf -t web3-copilot .
docker run -p 7860:7860 -p 11434:11434 web3-copilot
```

## πŸ“ Project Structure

```
β”œβ”€β”€ app.py                 # Main FastAPI application
β”œβ”€β”€ templates/             # HTML templates
β”œβ”€β”€ static/               # CSS and JavaScript files
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ agent/            # AI research agent
β”‚   β”œβ”€β”€ tools/            # API integration tools
β”‚   └── utils/            # Configuration and safety
β”œβ”€β”€ Dockerfile.hf         # HuggingFace Spaces Docker config
└── requirements.txt      # Python dependencies
```

## πŸ›‘οΈ AI Safety Features

- Input sanitization and validation
- Rate limiting protection
- Content filtering for harmful requests
- Response safety validation
- Comprehensive logging for monitoring

## πŸ“Š Supported APIs

- **CryptoCompare**: Price data and market statistics
- **DeFiLlama**: Protocol TVL and DeFi analytics  
- **Etherscan**: Ethereum network data and gas prices
- **CoinGecko**: Cryptocurrency market data
- **Custom Chart Data**: Historical price analysis

## 🀝 Contributing

This project implements responsible AI practices and focuses on legitimate cryptocurrency research and education.

## πŸ“„ License

MIT License - see LICENSE file for details

---

Built with ❀️ for the crypto research community