# استفاده از مدل‌های Hugging Face به عنوان منابع داده ## 📊 Endpoint‌های جدید ### 1. لیست مدل‌های موجود ```bash GET /api/models/list ``` **Response:** ```json { "success": true, "total_models": 15, "models": [ { "id": "crypto_sent_0", "model_id": "ElKulako/cryptobert", "task": "sentiment-analysis", "category": "crypto_sentiment", "requires_auth": true, "endpoint": "/api/models/crypto_sent_0/predict" } ], "categories": {...} } ``` ### 2. اطلاعات یک مدل خاص ```bash GET /api/models/{model_key}/info ``` **Example:** ```bash GET /api/models/crypto_sent_0/info ``` ### 3. استفاده از یک مدل برای تولید داده ```bash POST /api/models/{model_key}/predict ``` **Body:** ```json { "text": "Bitcoin is going to the moon!" } ``` **Response:** ```json { "success": true, "model_key": "crypto_sent_0", "model_id": "ElKulako/cryptobert", "task": "sentiment-analysis", "input": "Bitcoin is going to the moon!", "output": { "label": "POSITIVE", "score": 0.95 }, "timestamp": "2025-01-XX..." } ``` ### 4. پردازش دسته‌ای با چند مدل ```bash POST /api/models/batch/predict ``` **Body:** ```json { "texts": [ "Bitcoin is bullish", "Ethereum price dropping" ], "models": ["crypto_sent_0", "financial_sent_0"] } ``` ### 5. دریافت داده‌های تولید شده توسط مدل‌ها ```bash GET /api/models/data/generated?limit=50&model_key=crypto_sent_0&symbol=BTC ``` ### 6. آمار داده‌های تولید شده ```bash GET /api/models/data/stats ``` ## 🔗 مدل‌ها به عنوان Providers مدل‌های HF به صورت خودکار در `/api/providers` نمایش داده می‌شوند: ```json { "provider_id": "hf_model_crypto_sent_0", "name": "HF Model: ElKulako/cryptobert", "category": "crypto_sentiment", "type": "hf_model", "status": "available", "endpoint": "/api/models/crypto_sent_0/predict" } ``` ## 📝 مثال استفاده ### تحلیل احساسات با یک مدل خاص: ```bash curl -X POST http://localhost:7860/api/models/crypto_sent_0/predict \ -H "Content-Type: application/json" \ -d '{"text": "Bitcoin is bullish today"}' ``` ### پردازش دسته‌ای: ```bash curl -X POST http://localhost:7860/api/models/batch/predict \ -H "Content-Type: application/json" \ -d '{ "texts": ["BTC bullish", "ETH bearish"], "models": ["crypto_sent_0", "financial_sent_0"] }' ``` ### دریافت داده‌های تولید شده: ```bash curl http://localhost:7860/api/models/data/generated?limit=10&symbol=BTC ``` ## 🎯 مزایا 1. ✅ مدل‌ها به عنوان منابع داده قابل دسترسی هستند 2. ✅ می‌توانید از هر مدل به صورت مستقل استفاده کنید 3. ✅ داده‌های تولید شده در database ذخیره می‌شوند 4. ✅ می‌توانید آمار و تاریخچه را مشاهده کنید 5. ✅ پردازش دسته‌ای برای کارایی بیشتر ## 📊 مدل‌های موجود - **Crypto Sentiment**: `crypto_sent_0`, `crypto_sent_1`, ... - **Social Sentiment**: `social_sent_0`, `social_sent_1` - **Financial Sentiment**: `financial_sent_0`, `financial_sent_1` - **News Sentiment**: `news_sent_0` همه این مدل‌ها به عنوان endpoint و provider در دسترس هستند!