incendies commited on
Commit
f8dd3ca
·
1 Parent(s): 2919014

feat: Add multiple free AI tools to the workflow, including upscaler, image generation, and text-to-3D, and update the README to document them.

Browse files
Files changed (2) hide show
  1. README.md +48 -18
  2. app.py +78 -5
README.md CHANGED
@@ -1,33 +1,63 @@
1
  ---
2
- title: Imageat Workflow
3
- emoji: 📚
4
- colorFrom: gray
5
- colorTo: purple
6
  sdk: gradio
7
  sdk_version: 6.5.1
8
  app_file: app.py
9
  pinned: false
10
  license: mit
11
- short_description: Daggr workflow engine image processing & AI nodes for Next
12
  ---
13
 
14
- Daggr workflow (background removal, etc.) for use from the Next.js app.
15
 
16
- ## Using this Space from the API (Next.js app)
17
 
18
- The Space must run with **Gradio** SDK so `@gradio/client` can connect (it needs JSON config, not HTML).
19
 
20
- ### If you see "Unexpected token '<', \"<!DOCTYPE\"..." when calling the API
 
 
 
 
 
 
21
 
22
- 1. **Check README.md** – At the root of this repo, the first line block must contain:
23
- ```yaml
24
- sdk: gradio
25
- app_file: app.py
26
- ```
27
- 2. **Push to the Space** – Commit and push this README (and the rest of the repo) to the Space so Hugging Face rebuilds from it.
28
- 3. **Space settings** – On [your Space](https://huggingface.co/spaces/incendies/imageat-workflow), open **Settings** (or the Space’s **Files**). The SDK is read from the **README.md** YAML; you cannot change SDK in the UI, only via that file. Ensure there is no `sdk: docker` in README.
29
- 4. **Rebuild** – After pushing `sdk: gradio`, the Space will rebuild. Wait until it shows **Running** (not “Fetching metadata from the HF Docker repository”). Then the Next.js app can call this Space first for background removal.
30
 
31
- **Hâlâ HTML hatası alıyorsan:** Space ilk kurulurken Docker seçilmiş olabilir; HF bazen README ile runtime değiştirmiyor. [Space Settings](https://huggingface.co/spaces/incendies/imageat-workflow/settings) → **Factory reboot** dene. Olmazsa [yeni Space oluştur](https://huggingface.co/new-space), **SDK: Gradio** seç, aynı dosyaları push et; Next.js API'de Space adını güncelle.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
 
33
  [Spaces configuration reference](https://huggingface.co/docs/hub/spaces-config-reference)
 
1
  ---
2
+ title: Imageat Workflow - Free Tools
3
+ emoji: 🎨
4
+ colorFrom: purple
5
+ colorTo: blue
6
  sdk: gradio
7
  sdk_version: 6.5.1
8
  app_file: app.py
9
  pinned: false
10
  license: mit
11
+ short_description: Free AI tools - Background Removal, Upscaler, FLUX, Z-Image, Text to 3D
12
  ---
13
 
14
+ # Imageat Workflow - Free AI Tools
15
 
16
+ Collection of **free AI tools** powered by Daggr for use with the Imageat Next.js application.
17
 
18
+ ## 🎨 Available Free Tools
19
 
20
+ | Tool | Description | Input | Output |
21
+ |------|-------------|-------|--------|
22
+ | **Background Removal** | Remove background from images using AI | Image | Image |
23
+ | **Image Upscaler** | Enhance image resolution with AI upscaling | Image | Image |
24
+ | **Z-Image Turbo** | Fast image generation with Tongyi Z-Image model | Prompt | Image |
25
+ | **FLUX.2 Klein 9B** | Generate images with Black Forest Labs FLUX.2 model | Prompt | Image |
26
+ | **Text to 3D** | Transform text prompts into 3D models | Prompt | 3D Model |
27
 
28
+ ## 🔗 Underlying Spaces
 
 
 
 
 
 
 
29
 
30
+ These tools connect to the following HuggingFace Spaces:
31
+
32
+ - `hf-applications/background-removal` - GPU-accelerated background removal
33
+ - `Phips/Upscaler` - AI image upscaling with multiple models
34
+ - `hf-applications/Z-Image-Turbo` - Fast image generation
35
+ - `black-forest-labs/FLUX.2-klein-9B` - FLUX.2 Klein 9B model
36
+ - `hysts-daggr/daggr-text-to-image-to-3d` - Text to 3D pipeline
37
+
38
+ ## 📡 API Usage
39
+
40
+ This Space is designed to be called from the Next.js app via `@gradio/client`.
41
+
42
+ ### Example API Call
43
+
44
+ ```typescript
45
+ import { Client } from "@gradio/client";
46
+
47
+ const client = await Client.connect("incendies/imageat-workflow");
48
+ const result = await client.predict("/image", { image: myImageBlob });
49
+ ```
50
+
51
+ ## 🛠️ Configuration
52
+
53
+ The Space must run with **Gradio** SDK so `@gradio/client` can connect.
54
+
55
+ ### Troubleshooting
56
+
57
+ If you see "Unexpected token '<', \"<!DOCTYPE\"..." when calling the API:
58
+
59
+ 1. Ensure `sdk: gradio` is in this README's frontmatter
60
+ 2. Push changes and wait for rebuild
61
+ 3. Space must show **Running** status before API calls work
62
 
63
  [Spaces configuration reference](https://huggingface.co/docs/hub/spaces-config-reference)
app.py CHANGED
@@ -1,8 +1,12 @@
1
  import gradio as gr
2
  from daggr import GradioNode, Graph
3
 
4
- # Background removal: API returns (original, processed). Hide first with None, show final_image.
5
- # hf-applications/background-removal runs on GPU (Zero); use merve/background-removal for CPU.
 
 
 
 
6
  bg_remover = GradioNode(
7
  "hf-applications/background-removal",
8
  api_name="/image",
@@ -10,10 +14,79 @@ bg_remover = GradioNode(
10
  inputs={"image": gr.Image()},
11
  outputs={
12
  "original_image": None,
13
- "final_image": gr.Image(label="Processed Image"),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  },
15
  )
16
 
17
- # Add more nodes here (Video Gen, Watermark Remover, etc.) as needed
18
- graph = Graph(name="Imageat Workflow", nodes=[bg_remover])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  graph.launch()
 
1
  import gradio as gr
2
  from daggr import GradioNode, Graph
3
 
4
+ # ==================== FREE TOOLS COLLECTION ====================
5
+ # These tools are free to use and don't consume credits
6
+
7
+ # 1. Background Removal
8
+ # API returns (original, processed). Hide first with None, show final_image.
9
+ # hf-applications/background-removal runs on GPU (Zero)
10
  bg_remover = GradioNode(
11
  "hf-applications/background-removal",
12
  api_name="/image",
 
14
  inputs={"image": gr.Image()},
15
  outputs={
16
  "original_image": None,
17
+ "final_image": gr.Image(label="Background Removed"),
18
+ },
19
+ )
20
+
21
+ # 2. Image Upscaler
22
+ # Phips/Upscaler - Enhance image resolution with AI upscaling
23
+ upscaler = GradioNode(
24
+ "Phips/Upscaler",
25
+ api_name="/predict",
26
+ run_locally=False,
27
+ inputs={
28
+ "image": gr.Image(),
29
+ },
30
+ outputs={
31
+ "upscaled_image": gr.Image(label="Upscaled Image"),
32
  },
33
  )
34
 
35
+ # 3. Z-Image Turbo
36
+ # hf-applications/Z-Image-Turbo - Fast image generation
37
+ z_image_turbo = GradioNode(
38
+ "hf-applications/Z-Image-Turbo",
39
+ api_name="/predict",
40
+ run_locally=False,
41
+ inputs={
42
+ "prompt": gr.Textbox(label="Prompt"),
43
+ },
44
+ outputs={
45
+ "generated_image": gr.Image(label="Generated Image"),
46
+ },
47
+ )
48
+
49
+ # 4. FLUX.2 Klein 9B
50
+ # black-forest-labs/FLUX.2-klein-9B - Generate or edit images with FLUX.2 Klein model
51
+ flux_klein = GradioNode(
52
+ "black-forest-labs/FLUX.2-klein-9B",
53
+ api_name="/generate",
54
+ run_locally=False,
55
+ inputs={
56
+ "prompt": gr.Textbox(label="Prompt"),
57
+ },
58
+ outputs={
59
+ "result": gr.Image(label="Generated Image"),
60
+ "seed_output": None,
61
+ },
62
+ )
63
+
64
+ # 5. Text to Image to 3D (Daggr)
65
+ # hysts-daggr/daggr-text-to-image-to-3d - Transform text prompts into 3D models
66
+ text_to_3d = GradioNode(
67
+ "hysts-daggr/daggr-text-to-image-to-3d",
68
+ api_name="/predict",
69
+ run_locally=False,
70
+ inputs={
71
+ "prompt": gr.Textbox(label="Prompt"),
72
+ },
73
+ outputs={
74
+ "result": gr.Model3D(label="3D Model"),
75
+ },
76
+ )
77
+
78
+ # ==================== GRAPH SETUP ====================
79
+ # Create the workflow graph with all free tools
80
+ graph = Graph(
81
+ name="Imageat Workflow - Free Tools",
82
+ nodes=[
83
+ bg_remover,
84
+ upscaler,
85
+ z_image_turbo,
86
+ flux_klein,
87
+ text_to_3d,
88
+ ]
89
+ )
90
+
91
+ # Launch the Space
92
  graph.launch()