File size: 4,736 Bytes
5cd2b89 |
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 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 |
# π Quick Start Guide - Crypto API Monitor with HuggingFace Integration
## β
Server is Running!
Your application is now live at: **http://localhost:7860**
## π± Access Points
### 1. Main Dashboard (Full Features)
**URL:** http://localhost:7860/index.html
Features:
- Real-time API monitoring
- Provider inventory
- Rate limit tracking
- Connection logs
- Schedule management
- Data freshness monitoring
- Failure analysis
- **π€ HuggingFace Tab** (NEW!)
### 2. HuggingFace Console (Standalone)
**URL:** http://localhost:7860/hf_console.html
Features:
- HF Health Status
- Models Registry Browser
- Datasets Registry Browser
- Local Search (snapshot)
- Sentiment Analysis (local pipeline)
### 3. API Documentation
**URL:** http://localhost:7860/docs
Interactive API documentation with all endpoints
## π€ HuggingFace Features
### Available Endpoints:
1. **Health Check**
```
GET /api/hf/health
```
Returns: Registry health, last refresh time, model/dataset counts
2. **Force Refresh Registry**
```
POST /api/hf/refresh
```
Manually trigger registry update from HuggingFace Hub
3. **Get Models Registry**
```
GET /api/hf/registry?kind=models
```
Returns: List of all cached crypto-related models
4. **Get Datasets Registry**
```
GET /api/hf/registry?kind=datasets
```
Returns: List of all cached crypto-related datasets
5. **Search Registry**
```
GET /api/hf/search?q=crypto&kind=models
```
Search local snapshot for models or datasets
6. **Run Sentiment Analysis**
```
POST /api/hf/run-sentiment
Body: {"texts": ["BTC strong", "ETH weak"]}
```
Analyze crypto sentiment using local transformers
## π― How to Use
### Option 1: Main Dashboard
1. Open http://localhost:7860/index.html in your browser
2. Click on the **"π€ HuggingFace"** tab at the top
3. Explore:
- Health status
- Models and datasets registries
- Search functionality
- Sentiment analysis
### Option 2: Standalone HF Console
1. Open http://localhost:7860/hf_console.html
2. All HF features in a clean, focused interface
3. Perfect for testing and development
## π§ͺ Test the Integration
### Test 1: Check Health
```powershell
Invoke-WebRequest -Uri "http://localhost:7860/api/hf/health" -UseBasicParsing | Select-Object -ExpandProperty Content
```
### Test 2: Refresh Registry
```powershell
Invoke-WebRequest -Uri "http://localhost:7860/api/hf/refresh" -Method POST -UseBasicParsing | Select-Object -ExpandProperty Content
```
### Test 3: Get Models
```powershell
Invoke-WebRequest -Uri "http://localhost:7860/api/hf/registry?kind=models" -UseBasicParsing | Select-Object -ExpandProperty Content
```
### Test 4: Run Sentiment Analysis
```powershell
$body = @{texts = @("BTC strong breakout", "ETH looks weak")} | ConvertTo-Json
Invoke-WebRequest -Uri "http://localhost:7860/api/hf/run-sentiment" -Method POST -Body $body -ContentType "application/json" -UseBasicParsing | Select-Object -ExpandProperty Content
```
## π What's Included
### Seed Models (Always Available):
- ElKulako/cryptobert
- kk08/CryptoBERT
### Seed Datasets (Always Available):
- linxy/CryptoCoin
- WinkingFace/CryptoLM-Bitcoin-BTC-USDT
- WinkingFace/CryptoLM-Ethereum-ETH-USDT
- WinkingFace/CryptoLM-Solana-SOL-USDT
- WinkingFace/CryptoLM-Ripple-XRP-USDT
### Auto-Discovery:
- Searches HuggingFace Hub for crypto-related models
- Searches for sentiment-analysis models
- Auto-refreshes every 6 hours (configurable)
## βοΈ Configuration
Edit `.env` file to customize:
```env
# HuggingFace Token (optional, for higher rate limits)
HUGGINGFACE_TOKEN=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
# Enable/disable local sentiment analysis
ENABLE_SENTIMENT=true
# Model selection
SENTIMENT_SOCIAL_MODEL=ElKulako/cryptobert
SENTIMENT_NEWS_MODEL=kk08/CryptoBERT
# Refresh interval (seconds)
HF_REGISTRY_REFRESH_SEC=21600
# HTTP timeout (seconds)
HF_HTTP_TIMEOUT=8.0
```
## π Stop the Server
Press `CTRL+C` in the terminal where the server is running
Or use the process manager to stop process ID 6
## π Restart the Server
```powershell
python simple_server.py
```
## π Notes
- **First Load**: The first sentiment analysis may take 30-60 seconds as models download
- **Registry**: Auto-refreshes every 6 hours, or manually via the UI
- **Free Resources**: All endpoints use free HuggingFace APIs
- **No API Key Required**: Works without authentication (with rate limits)
- **Local Inference**: Sentiment analysis runs locally using transformers
## π You're All Set!
The application is running and ready to use. Open your browser and explore!
**Main Dashboard:** http://localhost:7860/index.html
**HF Console:** http://localhost:7860/hf_console.html
|