Spaces:
Sleeping
A newer version of the Gradio SDK is available: 6.24.0
π Vish AI - Deployment Guide
π¦ Essential Files for Hugging Face Spaces
Upload these 3 files only:
app.py(18KB) - Main application with Phi-3 integrationrequirements.txt(515 bytes) - All dependenciesREADME.md(7.1KB) - Space description and info
That's it! Everything else is optional.
π― Quick Deploy Steps
1. Create Hugging Face Space
Go to: https://huggingface.co/new-space
Settings:
- Owner: Your username
- Space name:
vish-ai(or your choice) - License: MIT
- SDK: Gradio
- Python version: 3.10 or 3.11 β οΈ (Required)
- Hardware:
- CPU Basic (FREE) - Works, but slower (3-6s responses)
- T4 GPU ($0.60/hr) - Recommended (0.5-2s responses)
2. Upload Files
Option A - Web Upload:
- Click "Files" tab in your new Space
- Click "Add file" β "Upload files"
- Upload:
app.py,requirements.txt,README.md - Click "Commit to main"
Option B - Git Clone:
git clone https://huggingface.co/spaces/YOUR_USERNAME/vish-ai
cd vish-ai
cp /path/to/app.py .
cp /path/to/requirements.txt .
cp /path/to/README.md .
git add .
git commit -m "Deploy Vish AI with Phi-3"
git push
3. Wait for Build
β±οΈ First build takes 15-20 minutes:
- Installing dependencies: ~3 min
- Downloading Phi-3 model (7GB): ~10-15 min
- Starting app: ~2 min
Watch the logs (click "Logs" tab) for:
π₯ Loading Phi-3 Mini unified model...
Model: microsoft/Phi-3-mini-4k-instruct
This may take 5-15 minutes on first run (downloading ~7GB)...
Loading tokenizer...
β
Tokenizer loaded
Loading model (this is the slow part)...
β
Phi-3 Mini model loaded successfully!
π Unified model ready for all tasks!
Model parameters: 3,821,079,552
β
All systems ready!
Running on local URL: http://0.0.0.0:7860
4. Test Your Space
Once live, test all 3 features:
Chat:
- Input: "What is artificial intelligence?"
- Expected: Intelligent multi-paragraph response
Summarize:
- Input: Paste 100+ word article
- Expected: 2-3 sentence summary
Sentiment:
- Input: "I absolutely love this product!"
- Expected: "π POSITIVE"
π Optional: Add Supabase Authentication
If you want user authentication and logging:
- Go to Space Settings β "Variables and secrets"
- Add these secrets:
NEXT_PUBLIC_SUPABASE_URL = https://lyebtceryednzafhyunq.supabase.co NEXT_PUBLIC_SUPABASE_ANON_KEY = your_anon_key_here - Restart Space
Without Supabase: App works perfectly, just no user logging.
π Performance Expectations
| Hardware | Chat | Summarize | Sentiment |
|---|---|---|---|
| CPU Basic (FREE) | 3-6s | 4-8s | 2-4s |
| T4 GPU Small | 0.5-1.5s | 1-2s | 0.3-0.8s |
| A10G GPU | 0.2-0.6s | 0.5-1s | 0.2-0.5s |
π§ Troubleshooting
β Build fails with "Out of Memory"
Fix: Model is optimized for CPU. If still failing:
- Upgrade to T4 GPU (has more memory)
- Check logs for specific error
β "AI models not available" in app
Fix:
- Wait for build to complete (full 20 minutes)
- Check logs for download progress
- Ensure Python 3.10 or 3.11 (not 3.12+)
β Slow responses (>10 seconds)
Fix:
- Normal on CPU Basic (AI is compute-intensive)
- Upgrade to T4 GPU for 5-10x speedup
- First response is slower (model warmup)
β Model not downloading
Fix:
- Check build logs for errors
- Ensure internet access (Spaces have it)
- Wait full 20 minutes before retrying
π Optional Files Explained
test_phi3_model.py (8.3KB)
Test the model locally before deploying:
pip install -r requirements.txt
python test_phi3_model.py
fine_tune_phi3.py (6.8KB)
Fine-tune Phi-3 on your custom data (advanced):
python fine_tune_phi3.py
supabase_setup.sql (6KB)
SQL schema for Supabase database tables (if using auth).
β Success Checklist
- Space created on Hugging Face
- Python version is 3.10 or 3.11
- Files uploaded:
app.py,requirements.txt,README.md - Build completed without errors
- Logs show: "β Phi-3 Mini model loaded successfully!"
- Chat responds intelligently
- Summarizer condenses text
- Sentiment analyzer detects emotions
- Response times acceptable for your use case
π Your Live Space
After deployment, share your app:
https://huggingface.co/spaces/YOUR_USERNAME/vish-ai
Example:
https://huggingface.co/spaces/vishwas896/vish-ai
π‘ Pro Tips
- Start with CPU Basic (free) for testing
- Monitor usage - upgrade to GPU only if needed
- First response is slower (model warmup) - this is normal
- Check logs regularly during first build
- Test all features before sharing publicly
- GPU pricing: Only charged when Space is running
- Pause Space when not in use to save costs (GPU only)
οΏ½ Need Help?
- Build logs: Check for detailed error messages
- Hugging Face Docs: https://huggingface.co/docs/hub/spaces
- GitHub Issues: Report problems in your repo
π What You've Built
β¨ Powerful AI assistant with:
- Microsoft Phi-3 Mini (3.8 billion parameters)
- Chat, Summarization, and Sentiment Analysis
- Clean, production-ready code
- Deployed on Hugging Face's infrastructure
- Optional user authentication with Supabase
Total setup: Just 3 files, ~25KB. That's it!
Built with β€οΈ by Vishwas | Powered by Microsoft Phi-3 & Hugging Face