Spaces:
Sleeping
A newer version of the Gradio SDK is available:
6.4.0
Cloud GPU Integration Guide
This document provides instructions for using the cloud-based GPU version of the AI-Powered Facial and Body Feature Editor, which leverages InstructPix2Pix for GPU-accelerated processing without requiring any local setup.
Overview
The cloud-based GPU version of the application uses InstructPix2Pix, a public GPU-accelerated Space on Hugging Face, to process your images. This approach offers several benefits:
- GPU-accelerated processing without local setup
- Works on any device with internet access
- No need to install CUDA or PyTorch
- Simpler deployment and maintenance
How It Works
- Your image is sent to the InstructPix2Pix Space
- Your feature selections are converted to text instructions
- The Space processes your image using GPU acceleration
- The edited image is returned to the interface
Setup Instructions
- Download the
app_cloud_gpu.pyfile - Replace your current
app.pyfile in your Hugging Face Space with this file - Commit and push the changes to your Space
- Your Space will automatically rebuild with the cloud GPU integration
# In your local repository
cp app_cloud_gpu.py app.py
git add app.py
git commit -m "Implement cloud GPU integration with InstructPix2Pix"
git push
Feature Mapping
The application maps your feature selections to text instructions that InstructPix2Pix can understand:
| Feature Type | Modification Type | Instruction |
|---|---|---|
| Eyes | Larger | "make the eyes larger" |
| Eyes | Smaller | "make the eyes smaller" |
| Face Shape | Slim | "make the face slimmer" |
| Lips | Fuller | "make the lips fuller" |
| ... | ... | ... |
The intensity slider modifies these instructions:
- Low intensity (0.1-0.3): Adds "slightly" to the instruction
- Medium intensity (0.4-0.7): Uses the base instruction
- High intensity (0.8-1.0): Adds "dramatically" to the instruction
Custom Prompts
You can also use custom prompts for more specific edits. Enable the "Use Custom Prompt" checkbox and enter your desired instruction, such as:
- "make the eyes blue and add long eyelashes"
- "add a subtle smile"
- "make the hair curly and blonde"
Performance Considerations
- Processing typically takes 10-30 seconds depending on server load
- The InstructPix2Pix Space may have usage limits or queues
- Images are automatically resized to 512x512 pixels for optimal processing
Troubleshooting
If you encounter issues:
- Connection errors: The InstructPix2Pix Space might be temporarily unavailable. Try again later.
- Processing errors: Try a different image or a simpler edit instruction.
- Unexpected results: Adjust your instruction or try using a custom prompt for more control.
Limitations
- Less precise control compared to direct feature manipulation
- Results depend on how well InstructPix2Pix understands the instructions
- Subject to the availability of the public InstructPix2Pix Space
Future Improvements
- Add support for additional public GPU Spaces
- Implement a fallback mechanism if InstructPix2Pix is unavailable
- Expand the instruction mapping for more specific edits