Spaces:
Running
on
Zero
Running
on
Zero
Upload 3 files
Browse files- DEPLOY.md +70 -0
- README.md +30 -7
- requirements.txt +4 -0
DEPLOY.md
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Deploying to HuggingFace Spaces
|
| 2 |
+
|
| 3 |
+
## Quick Deploy
|
| 4 |
+
|
| 5 |
+
1. **Create a new Space on HuggingFace**:
|
| 6 |
+
- Go to https://huggingface.co/spaces
|
| 7 |
+
- Click "Create new Space"
|
| 8 |
+
- Name: `PromptBridge-Demo` (or your choice)
|
| 9 |
+
- License: Apache 2.0
|
| 10 |
+
- SDK: Gradio
|
| 11 |
+
- Hardware: CPU (basic) - should be sufficient for 0.6B model
|
| 12 |
+
|
| 13 |
+
2. **Upload files**:
|
| 14 |
+
```bash
|
| 15 |
+
# Clone your new space
|
| 16 |
+
git clone https://huggingface.co/spaces/YOUR_USERNAME/YOUR_SPACE_NAME
|
| 17 |
+
cd YOUR_SPACE_NAME
|
| 18 |
+
|
| 19 |
+
# Copy files from promptbridge-space/
|
| 20 |
+
cp ../promptbridge-space/app.py .
|
| 21 |
+
cp ../promptbridge-space/requirements.txt .
|
| 22 |
+
cp ../promptbridge-space/README.md .
|
| 23 |
+
|
| 24 |
+
# Commit and push
|
| 25 |
+
git add .
|
| 26 |
+
git commit -m "Initial commit"
|
| 27 |
+
git push
|
| 28 |
+
```
|
| 29 |
+
|
| 30 |
+
3. **Alternative: Use HF CLI**:
|
| 31 |
+
```bash
|
| 32 |
+
# From the langchain directory
|
| 33 |
+
huggingface-cli upload YOUR_USERNAME/YOUR_SPACE_NAME promptbridge-space --repo-type=space
|
| 34 |
+
```
|
| 35 |
+
|
| 36 |
+
## Local Testing
|
| 37 |
+
|
| 38 |
+
Test locally before deploying:
|
| 39 |
+
```bash
|
| 40 |
+
cd promptbridge-space
|
| 41 |
+
python app.py
|
| 42 |
+
```
|
| 43 |
+
|
| 44 |
+
Then visit http://127.0.0.1:7860
|
| 45 |
+
|
| 46 |
+
## Hardware Requirements
|
| 47 |
+
|
| 48 |
+
- **CPU Basic**: Works well for this 0.6B model
|
| 49 |
+
- **CPU Upgrade**: Slightly faster inference
|
| 50 |
+
- **GPU**: Overkill for this small model
|
| 51 |
+
|
| 52 |
+
## Configuration Options
|
| 53 |
+
|
| 54 |
+
Edit `app.py` to customize:
|
| 55 |
+
- Default temperature (currently 0.7)
|
| 56 |
+
- Default max_tokens (currently 512)
|
| 57 |
+
- Examples
|
| 58 |
+
- UI colors/theme
|
| 59 |
+
|
| 60 |
+
## Tips
|
| 61 |
+
|
| 62 |
+
1. **First load is slow**: Model downloads from HF Hub (~1.2GB)
|
| 63 |
+
2. **Subsequent loads are fast**: Model is cached
|
| 64 |
+
3. **CPU inference**: Expect 1-3 seconds per generation
|
| 65 |
+
4. **Consider caching examples**: Set `cache_examples=True` in Examples for faster demo
|
| 66 |
+
|
| 67 |
+
## Monitoring
|
| 68 |
+
|
| 69 |
+
Check Space logs at:
|
| 70 |
+
`https://huggingface.co/spaces/YOUR_USERNAME/YOUR_SPACE_NAME/logs`
|
README.md
CHANGED
|
@@ -1,14 +1,37 @@
|
|
| 1 |
---
|
| 2 |
-
title: PromptBridge
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: gradio
|
| 7 |
-
sdk_version:
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: apache-2.0
|
| 11 |
-
short_description: Expand keywords into full t2i prompts, or do the revese.
|
| 12 |
---
|
| 13 |
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: PromptBridge-0.6b-Alpha
|
| 3 |
+
emoji: 🌉
|
| 4 |
+
colorFrom: purple
|
| 5 |
+
colorTo: blue
|
| 6 |
sdk: gradio
|
| 7 |
+
sdk_version: 4.44.0
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: apache-2.0
|
|
|
|
| 11 |
---
|
| 12 |
|
| 13 |
+
# PromptBridge-0.6b-Alpha Demo
|
| 14 |
+
|
| 15 |
+
Interactive demo for [PromptBridge-0.6b-Alpha](https://huggingface.co/retowyss/PromptBridge-0.6b-Alpha), a specialized model for bidirectional prompt transformation for text-to-image generation.
|
| 16 |
+
|
| 17 |
+
## Features
|
| 18 |
+
|
| 19 |
+
- **Prompt Expansion**: Convert brief keywords into detailed image generation prompts
|
| 20 |
+
- **Prompt Compression**: Distill lengthy descriptions into sentences or keywords
|
| 21 |
+
- **Variation Generation**: Chain operations for creative prompt variations
|
| 22 |
+
|
| 23 |
+
## Model Info
|
| 24 |
+
|
| 25 |
+
- **Base**: Qwen3-0.6B
|
| 26 |
+
- **Training**: 300K synthetic prompt pairs
|
| 27 |
+
- **Domain**: Single adult humanoid subjects
|
| 28 |
+
- **Content**: PG to R-rated (X-rated removed)
|
| 29 |
+
|
| 30 |
+
## Usage
|
| 31 |
+
|
| 32 |
+
1. Select a mode (Expand/Compress to Sentence/Compress to Keywords)
|
| 33 |
+
2. Enter your prompt
|
| 34 |
+
3. Adjust temperature and max tokens as needed
|
| 35 |
+
4. Click Generate
|
| 36 |
+
|
| 37 |
+
⚠️ **Note**: This model is specialized for prompt transformation only and cannot perform general tasks.
|
requirements.txt
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
gradio==4.44.0
|
| 2 |
+
transformers==4.46.0
|
| 3 |
+
torch==2.5.1
|
| 4 |
+
accelerate==1.1.1
|