Spaces:
Sleeping
Sleeping
A newer version of the Gradio SDK is available:
6.1.0
Quick Start Guide
π Get Started in 3 Steps
Option A: Deploy to Hugging Face Spaces (Recommended)
Create a Space
- Go to https://huggingface.co/new-space
- Name:
ai-text-assistant(or your choice) - SDK: Select "Gradio"
- Visibility: Public or Private
Upload Files
- Upload these files to your Space:
app.pyrequirements.txtREADME.md
OR clone and push:
git clone https://huggingface.co/spaces/YOUR_USERNAME/ai-text-assistant cd ai-text-assistant # Copy app.py, requirements.txt, README.md here git add . git commit -m "Initial commit" git push- Upload these files to your Space:
Wait & Use
- Space builds automatically (~5-10 min first time)
- Access at:
https://huggingface.co/spaces/YOUR_USERNAME/ai-text-assistant - Share with others!
Option B: Run Locally
Install Dependencies
pip install -r requirements.txtRun the App
python app.pyOpen Browser
- Navigate to: http://127.0.0.1:7860
- Models download on first run (~2.5GB total)
- Subsequent runs use cached models
π How to Use
Choose Mode
- Click "Text Generation" for creative writing
- Click "Text Summarization" for article summaries
Enter Text
- Type or paste your input (max 500 words)
- For generation: Write a prompt
- For summarization: Paste an article
Adjust Settings
- Use slider to set max tokens (10-500)
- Higher = longer output
Process
- Click "π Process" button
- Wait for AI to generate (5-30 seconds)
Explore Results
- Read the generated/summarized text
- Hover over any word to see:
- Top 5 alternative tokens
- Probability percentages
π‘ Example Inputs
Text Generation
Prompt: "Write a short story about a robot learning to paint"
Max Tokens: 150
Text Summarization
Input: [Paste a news article, blog post, or any long text]
Max Tokens: 100
β‘ Tips for Best Results
Text Generation
- Start with clear, specific prompts
- Use complete sentences
- Be creative with your prompts
- Higher token count = longer stories
Text Summarization
- Works best with well-structured articles
- Minimum ~100 words for good summaries
- News articles and blog posts work great
- Academic abstracts summarize well
π§ Troubleshooting
"Loading models..." takes forever
- First run downloads ~2.5GB of models
- Be patient, models are cached after
- Check your internet connection
"Out of memory" error
- Reduce max_tokens to 50-100
- Close other applications
- Consider using Hugging Face Spaces (cloud hosting)
Hover tooltips not showing
- Try a different browser
- Ensure JavaScript is enabled
- Check browser console for errors
Generation is slow
- CPU inference is slower than GPU
- On Hugging Face Spaces, upgrade to GPU tier
- Reduce max_tokens for faster results
π Documentation
- IMPLEMENTATION_SUMMARY.md - Complete technical details
- DEPLOYMENT.md - Detailed deployment guide
- APP_FLOW.md - Visual flow diagrams
- README.md - Project overview
π― What Makes This Special?
Unique Feature: Token Alternatives Visualization
Unlike typical AI text tools, this app shows you "behind the scenes" of how the AI thinks:
- Each word you see was chosen from multiple options
- Hover to see what the AI could have said instead
- Learn how language models work
- Understand model confidence through probabilities
Example:
Generated: "The quick brown fox"
Hover "quick" β Shows:
1. quick (45.2%)
2. fast (23.1%)
3. speedy (12.0%)
4. rapid (10.5%)
5. swift (9.2%)
This helps you understand:
- Why the AI chose specific words
- What alternatives were considered
- How confident the AI was in each choice
π Have Fun!
Experiment with different:
- Prompts and writing styles
- Text lengths
- Token limits
- Articles from various topics
The more you use it, the better you'll understand how AI language models make decisions!
Need Help? Check DEPLOYMENT.md for detailed troubleshooting or open an issue on the repository.