Spaces:
Sleeping
Sleeping
File size: 10,065 Bytes
578f8ce db26343 578f8ce db26343 578f8ce db26343 578f8ce db26343 578f8ce db26343 578f8ce db26343 578f8ce db26343 578f8ce db26343 578f8ce db26343 578f8ce db26343 578f8ce db26343 578f8ce db26343 578f8ce db26343 578f8ce db26343 578f8ce db26343 578f8ce db26343 578f8ce db26343 578f8ce db26343 578f8ce db26343 578f8ce |
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 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 |
---
title: TextArchive
emoji: ๐
colorFrom: blue
colorTo: purple
sdk: gradio
python_version: "3.11"
app_file: app.py
pinned: false
---
# TextArchive - Universal Text Management System
A powerful and intuitive web application for managing all your text-based content with a clear hierarchical structure: **Category โ Section โ Content Type โ Content**.
## ๐ฏ What is TextArchive?
TextArchive is not just a prompt manager - it's a universal system for organizing ANY text-based content:
- ๐ฌ Prompts for AI models
- ๐ Notes and documentation
- ๐ Code snippets (Python, JavaScript, SQL, etc.)
- ๐ LaTeX documents
- ๐ป Bash scripts
- โ๏ธ Functions and utilities
- ๐ HTML/CSS templates
- ๐ Any other text content
## ๐ Organization Structure
Your content is organized in a clear three-level hierarchy:
- **Category** (High-level grouping) - e.g., "Coding", "Writing", "Research"
- **Section** (Subsection under category) - e.g., "Python", "JavaScript", "Blog Posts"
- **Content Type** (What kind of content) - e.g., "python", "note", "prompt", "latex"
- **Content** (Your actual text)
Example hierarchy:
```
๐ Coding (Category)
โโโ ๐ Python (Section)
โโโ ๐ Python Code: "Function to calculate fibonacci..."
โโโ ๐ฌ Prompt: "Write a Python function that..."
โโโ ๐ JavaScript (Section)
โโโ ๐ JavaScript: "React component for login..."
๐ Research (Category)
โโโ ๐ AI Papers (Section)
โโโ ๐ Note: "Summary of transformer architecture..."
โโโ ๐ LaTeX: "\documentclass{article}..."
```
## โจ Features
### Core Functionality
- โ
**Add New Items**: Create content with custom categories, sections, and types
- ๐ **View All Items**: See all your content organized hierarchically
- ๐ **Auto-Filter**: Filters update automatically (AJAX-style, no search button needed)
- ๐ **Easy Copy**: Click any row to preview, then use the copy button to copy just the text content
- โ๏ธ **Edit Items**: Click any item to edit its details
- ๐๏ธ **Delete Items**: Remove items you no longer need
- ๐ฏ **Fixed Height Table**: Scrollable table maintains consistent size
- ๐พ **Persistent Storage**: SQLite database stores all your data
### Advanced Management
- ๐ **Rename Categories**: Rename categories and automatically update all items
- ๐ **Rename Sections**: Rename sections across all categories or within a specific category
- ๐๏ธ **Bulk Delete**: Delete entire categories or sections at once (with confirmation)
- ๐ **Statistics**: View insights about your content collection
- ๐ท๏ธ **11 Content Types**: Prompt, Note, Python, JavaScript, LaTeX, SQL, Bash, Function, HTML, CSS, Other
### Smart UX
- ๐ฏ **Filtered Dropdowns**: Section dropdown automatically filters by selected category
- ๐ **Auto-Refresh**: All dropdowns update automatically after changes
- โ ๏ธ **Confirmation Dialogs**: Destructive actions require confirmation
- ๐ฆ **Auto-Generated Titles**: Leave title empty to auto-generate from content
- ๐จ **Type Icons**: Visual icons for each content type
## ๐ How to Use
### Adding Content
1. Go to the "โ Add New Item" tab
2. Select or type a **Category** (high-level grouping)
3. Select or type a **Section** (subsection - dropdown auto-filters by category)
4. Choose **Content Type** (prompt, note, python, etc.)
5. (Optional) Enter a **Title** or leave empty for auto-generation
6. Enter your **Content**
7. Click "Add Item"
### Viewing and Filtering Content
1. Go to the "๐ View & Manage Items" tab
2. Use filters to narrow down items:
- **Filter by Category**: Auto-updates table
- **Filter by Section**: Auto-updates table (filtered by category)
- **Filter by Type**: Auto-updates table
3. Click "Clear Filters" to reset
### Copying Content
1. In the "View & Manage Items" tab, click on any row in the table
2. The content appears in the **Content Preview** box below
3. Click the **copy button** (๐) in the preview box, OR
4. Click in the text box and press Ctrl+A (select all), then Ctrl+C (copy)
5. Only the text content is copied - NO ID, category, or section included!
### Editing Content
1. Click on a row in the table to load it
2. The item loads in the editing section below
3. Modify Category, Section, Type, Title, or Content as needed
4. Click "๐พ Update Item" to save changes
### Deleting Content
1. Click on a row to select it
2. Click the "๐๏ธ Delete Item" button
3. The item will be removed immediately
### Managing Categories & Sections
1. Go to the "โ๏ธ Manage Categories & Sections" tab
**Rename Category:**
- Select the category to rename
- Enter new name
- Click "๐ Rename Category"
- All items in that category will be updated
**Rename Section:**
- (Optional) Select a category to limit scope
- Select the section to rename
- Enter new name
- Click "๐ Rename Section"
**Delete Category:**
- Select the category
- Check the confirmation box
- Click "๐๏ธ Delete Category"
- ALL items in that category will be deleted
**Delete Section:**
- (Optional) Select a category to limit scope
- Select the section
- Check the confirmation box
- Click "๐๏ธ Delete Section"
### Viewing Statistics
1. Go to the "๐ Statistics" tab
2. View total counts, top categories, and breakdown by type
3. Click "๐ Refresh Statistics" to update
## ๐จ Content Types
TextArchive supports 11 content types, each with its own icon and file extension:
| Type | Icon | Extension | Use For |
|------|------|-----------|---------|
| prompt | ๐ฌ | .txt | AI prompts and instructions |
| note | ๐ | .md | Notes and documentation |
| python | ๐ | .py | Python code and scripts |
| javascript | ๐ | .js | JavaScript code |
| latex | ๐ | .tex | LaTeX documents |
| sql | ๐๏ธ | .sql | SQL queries and scripts |
| bash | ๐ป | .sh | Bash shell scripts |
| function | โ๏ธ | .txt | Reusable functions |
| html | ๐ | .html | HTML markup |
| css | ๐จ | .css | CSS stylesheets |
| other | ๐ | .txt | Any other text content |
## ๐ง Technical Details
- **Framework**: Gradio 4.44.0+
- **Database**: SQLite (automatically created as `textarchive.db`)
- **Python**: 3.8+
- **Auto-Migration**: Automatically migrates from old `prompts.db` if exists
## ๐ Database Schema
```sql
CREATE TABLE text_items (
id INTEGER PRIMARY KEY AUTOINCREMENT,
category TEXT NOT NULL,
section TEXT NOT NULL,
title TEXT NOT NULL,
content TEXT NOT NULL,
content_type TEXT DEFAULT 'prompt',
file_extension TEXT DEFAULT '.txt',
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
```
Indexes are created on `category`, `section`, and `content_type` for optimal performance.
## ๐ Deployment to Hugging Face Spaces
### Method 1: Direct Upload
1. Create a new Space on Hugging Face:
- Go to https://huggingface.co/new-space
- Choose "Gradio" as the SDK
- Set visibility (Public or Private)
2. Upload these files to your Space:
- `app.py`
- `requirements.txt`
- `README.md` (optional)
3. Your app will automatically deploy!
### Method 2: Git (With Your Sync Script)
1. Initialize your local repository:
```bash
git init
git add .
git commit -m "Initial commit"
```
2. Add remotes:
```bash
# Add GitHub remote
git remote add github https://github.com/YOUR_USERNAME/textarchive.git
# Add Hugging Face remote
git remote add huggingface https://huggingface.co/spaces/YOUR_USERNAME/textarchive
```
3. Use your sync script:
```powershell
# Set your Hugging Face token
$env:HF_TOKEN = "your_hf_token_here"
# Run sync
.\sync.ps1 "Initial deployment"
```
## ๐ Migration from Old "Prompt Manager"
If you have an existing `prompts.db` from the old Prompt Manager:
1. **Automatic Migration**: Just run the new app - it will automatically:
- Detect the old `prompts.db`
- Create the new `textarchive.db` schema
- Migrate all your data
- Set content_type to "prompt" for all old items
- Generate titles from the first 50 characters
2. **Manual Backup** (Recommended):
```bash
# Backup your old database first
cp prompts.db prompts.db.backup
```
3. **Verify Migration**:
- Open the app
- Go to Statistics tab
- Check that all items were migrated
- Check a few items to ensure content is intact
## ๐ Notes
- The database file persists between sessions
- All users share the same database (unless you add authentication)
- Backup your `textarchive.db` file regularly
- Section dropdowns auto-filter by selected category for better UX
- Auto-filtering eliminates the need for a search button
- Fixed-height table with scrolling maintains clean interface
## ๐ฏ Use Cases
### For Developers
- Store code snippets and functions
- Organize SQL queries by project
- Keep bash scripts and automation tools
- Document API endpoints
### For Writers
- Organize story prompts and ideas
- Store article outlines
- Keep writing templates
- Manage blog post drafts
### For Researchers
- Store LaTeX document snippets
- Organize research notes by topic
- Keep citation templates
- Document methodologies
### For AI/ML Engineers
- Organize prompts by use case
- Store fine-tuning examples
- Document model configurations
- Keep evaluation templates
## ๐ฎ Future Enhancements (Suggestions)
- Export individual items as files
- Export category/section as ZIP
- Import from files/folders
- Tags system for cross-category organization
- Full-text search within content
- Syntax highlighting in preview
- Markdown rendering for notes
- Version history for items
- User authentication for private libraries
- API access for programmatic usage
- Favorites/bookmarks
- Sharing capabilities
## ๐ License
MIT License - Feel free to modify and use as needed!
## ๐ค Contributing
Contributions are welcome! Please feel free to submit issues or pull requests.
---
**Built with โค๏ธ using Gradio and SQLite** |