-
Notifications
You must be signed in to change notification settings - Fork 348
[inference providers] tutorial for image editing with inference providers #1880
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
@@ -0,0 +1,324 @@ | |||
# Building an AI Image Editor with Gradio and Inference Providers | |||
|
|||
In this guide, we'll build an AI-powered image editor that lets users upload images and edit them using natural language prompts. This project demonstrates how to combine Inference Providers with image-to-image models like [Qwen's Image Edit](https://huggingface.co/Qwen/Qwen-Image-Edit). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would include both Qwen-Image-Edit and Flux Kontext since both are SOTA
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very cool! We can recommend to upgrade to Pro for more inference credits, there are many opportunities to do so in the text.
|
||
1. **Accept image uploads** through a web interface | ||
2. **Process natural language prompts** editing instructions like "Turn the cat into a tiger" | ||
3. **Transform images** using Qwen Image Edit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3. **Transform images** using Qwen Image Edit | |
3. **Transform images** using Qwen Image Edit or FLUX.1 Kontext |
export HF_TOKEN="your_token_here" | ||
``` | ||
|
||
When you set this environment variable, it handles authentication automatically for all your inference calls. You can generate a token from [your settings page](https://huggingface.co/settings/tokens/new?ownUserPermissions=inference.serverless.write&tokenType=fineGrained). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice to link with the correct permission
uv add huggingface-hub>=0.34.4 gradio>=5.0.0 pillow>=11.3.0 | ||
``` | ||
|
||
The dependencies are now installed and ready to use! Also, `uv` will create a handy `pyproject.toml` file for you to manage your dependencies as a project. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The dependencies are now installed and ready to use! Also, `uv` will create a handy `pyproject.toml` file for you to manage your dependencies as a project. | |
The dependencies are now installed and ready to use! Also, `uv` will maintain the `pyproject.toml` file for you as you add dependencies. |
(just because we already mentioned that pyproject.toml
was created by uv init
)
- **Object removal**: Remove unwanted objects from images | ||
- **Provider comparison**: Benchmark different providers for your use case | ||
|
||
Happy building! And remember to share your app with the community on the hub. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happy building! And remember to share your app with the community on the hub. | |
Happy building! And remember to share your app with the community on the Hub. |
|
||
1. **Create a new Space**: Go to [huggingface.co/new-space](https://huggingface.co/new-space) | ||
2. **Choose Gradio SDK** and make it public | ||
3. **Upload your files**: Upload `main.py` and any example images |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also requirements.txt
if necessary, no? Users would have to create it manually from the toml file (unless there's a way to automate it)
This PR adds a guide on using Qwen Image Edit with inference providers.