CoolFace
Apppublic

rjarun20/pro-demo

sourceHugging Facemitupdated 1y agoView on Hugging Face
0likes
App README

๐Ÿš€ AI Research Hub - Complete HuggingFace Demo

A comprehensive demonstration of HuggingFace's Inference API capabilities, optimized for Hugging Face Spaces.

โœจ Features

๐Ÿ“ Text Processing

  • โ€”๐Ÿ’ฌ Chat - Conversational AI with advanced language models
  • โ€”๐ŸŽญ Fill Mask - Text completion and prediction
  • โ€”โ“ Question Answering - Extract answers from context
  • โ€”๐Ÿ“ Summarization - Automatic text summarization

๐Ÿท๏ธ Classification & Analysis

  • โ€”๐Ÿท๏ธ Sentiment Analysis - Emotion and sentiment detection
  • โ€”๐ŸŽฏ Zero-Shot Classification - Classify with custom labels
  • โ€”๐Ÿท๏ธ Named Entity Recognition - Extract people, places, organizations
  • โ€”๐Ÿงฎ Text Similarity - Compare semantic similarity between texts

๐ŸŽจ Multimodal Capabilities

  • โ€”๐ŸŒ Translation - English to French translation
  • โ€”๐Ÿ–ผ๏ธ Image Classification - Identify objects and scenes in images
  • โ€”๐ŸŽจ Text-to-Image - Generate images from text descriptions

๐Ÿ”ง Setup Instructions

For Hugging Face Spaces:

  1. 1.Fork/Duplicate this Space
  2. 2.Set up your HuggingFace Token:
  3. 3.Go to Settings โ†’ Repository secrets
  4. 4.Add a new secret: HF_TOKEN
  5. 5.Value: Your HuggingFace token from here
  1. 1.That's it! The Space will automatically restart and all features will be available.

For Local Development:

bash
# Clone the repository
git clone <your-repo-url>
cd <repo-name>

# Install dependencies
pip install -r requirements.txt

# Set environment variable
export HF_TOKEN="your_token_here"

# Run the application
python app.py

๐ŸŽฏ Key Improvements

โœ… Fixed Issues

  • โ€”Question Answering: Proper input format for API calls
  • โ€”Text Classification: Working models with proper error handling
  • โ€”Zero-Shot Classification: Correct API method usage
  • โ€”Named Entity Recognition: Fixed entity extraction and labeling
  • โ€”Image Classification: Better error handling for uploads

๐Ÿš€ Enhanced Features

  • โ€”Spaces Optimization: Memory and performance optimized for HF Spaces
  • โ€”Robust Error Handling: Clear error messages and fallback strategies
  • โ€”Modern UI: Clean, responsive interface with organized tabs
  • โ€”Token Management: Multiple token source detection for Spaces
  • โ€”Text Similarity: Semantic comparison with cosine similarity scores

๐Ÿ“Š Models Used

TaskModelDescription
Chatmicrosoft/DialoGPT-mediumConversational AI
Fill Maskdistilbert-base-uncasedLightweight BERT model
Q&Adistilbert-base-cased-distilled-squadSQuAD-trained model
Summarizationfacebook/bart-large-cnnCNN-trained BART
Sentimentcardiffnlp/twitter-roberta-base-sentiment-latestTwitter sentiment
Zero-Shotfacebook/bart-large-mnliMNLI-trained BART
NERdslim/bert-base-NERCoNLL-trained BERT
TranslationHelsinki-NLP/opus-mt-en-frEnglish-French translator
Embeddingssentence-transformers/all-MiniLM-L6-v2Sentence embeddings
Image Classificationgoogle/vit-base-patch16-224Vision Transformer
Text-to-Imagerunwayml/stable-diffusion-v1-5Stable Diffusion

๐Ÿ”’ Privacy & Security

  • โ€”No Data Storage: All processing happens in real-time, no data is stored
  • โ€”Secure Token Handling: Tokens are handled securely through Spaces secrets
  • โ€”API Rate Limiting: Built-in handling for API rate limits and quotas

๐Ÿšจ Troubleshooting

Common Issues:

  1. 1."API client not available"
  2. 2.Solution: Set HF_TOKEN in Spaces settings
  1. 1."Rate limit reached"
  2. 2.Solution: Wait a moment and try again
  1. 1."Model loading"
  2. 2.Solution: Some models need time to load, retry after a few seconds
  1. 1."Service unavailable"
  2. 2.Solution: Temporary HuggingFace service issue, try again later

๐Ÿ› ๏ธ Technical Details

Architecture

  • โ€”Frontend: Gradio with custom CSS
  • โ€”Backend: HuggingFace Inference API
  • โ€”Deployment: Optimized for HF Spaces environment
  • โ€”Error Handling: Comprehensive error catching and user feedback

Performance Optimizations

  • โ€”Memory Efficient: Minimal memory footprint for Spaces
  • โ€”Fast Models: Selected for quick response times
  • โ€”Graceful Degradation: Features degrade gracefully if dependencies missing
  • โ€”Connection Pooling: Efficient API client management

๐Ÿ“ˆ Future Enhancements

  • โ€”Advanced Visualization: Interactive embedding plots
  • โ€”Batch Processing: Multiple text processing
  • โ€”Custom Model Support: User-specified models
  • โ€”Audio Processing: Speech-to-text capabilities
  • โ€”Real-time Streaming: Live text generation

๐Ÿค Contributing

  1. 1.Fork the repository
  2. 2.Create a feature branch
  3. 3.Make your changes
  4. 4.Test thoroughly
  5. 5.Submit a pull request

๐Ÿ“„ License

This project is open source and available under the MIT License.

๐Ÿ™ Acknowledgments

  • โ€”HuggingFace for the amazing Inference API and Spaces platform
  • โ€”Gradio for the intuitive interface framework
  • โ€”Open Source Community for the incredible model ecosystem

Built with โค๏ธ for the AI research community