Spaces:
Sleeping
Sleeping
File size: 4,208 Bytes
c76198f |
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 |
# Quick Start Guide
## π Get Started in 3 Steps
### Option A: Deploy to Hugging Face Spaces (Recommended)
1. **Create a Space**
- Go to https://huggingface.co/new-space
- Name: `ai-text-assistant` (or your choice)
- SDK: Select "Gradio"
- Visibility: Public or Private
2. **Upload Files**
- Upload these files to your Space:
- `app.py`
- `requirements.txt`
- `README.md`
OR clone and push:
```bash
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
```
3. **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
1. **Install Dependencies**
```bash
pip install -r requirements.txt
```
2. **Run the App**
```bash
python app.py
```
3. **Open 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
1. **Choose Mode**
- Click "Text Generation" for creative writing
- Click "Text Summarization" for article summaries
2. **Enter Text**
- Type or paste your input (max 500 words)
- For generation: Write a prompt
- For summarization: Paste an article
3. **Adjust Settings**
- Use slider to set max tokens (10-500)
- Higher = longer output
4. **Process**
- Click "π Process" button
- Wait for AI to generate (5-30 seconds)
5. **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.
|