Skip to content

Commit b34affb

Browse files
Merge pull request #2 from ModelsLab/api-updates
feat: Interior: obj remover, interior_mixer, video/watermark-remover,…
2 parents 19c98ac + 00e7d6d commit b34affb

8 files changed

Lines changed: 357 additions & 11 deletions

File tree

README.md

Lines changed: 76 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,22 @@ Generate videos from text prompts.
133133

134134
```php
135135
$video = $modelslab->video();
136+
137+
// Text to Video
136138
$response = $video->textToVideo($videoSchema);
139+
140+
// Image to Video
141+
$response = $video->imageToVideo($imageToVideoSchema);
142+
143+
// Text to Video Ultra
144+
$response = $video->textToVideoUltra($text2VideoUltraSchema);
145+
146+
// Watermark Remover - Remove watermarks from videos
147+
$watermarkRemover = new WatermarkRemoverSchema([
148+
'key' => $apiKey,
149+
'init_video' => 'https://example.com/video.mp4'
150+
]);
151+
$response = $video->watermarkRemover($watermarkRemover);
137152
```
138153

139154
### 3D API
@@ -151,7 +166,40 @@ Generate interior design images.
151166

152167
```php
153168
$interior = $modelslab->interior();
154-
$response = $interior->interior($interiorSchema);
169+
170+
// Interior Design
171+
$response = $interior->makeInterior($interiorSchema);
172+
173+
// Room Decorator
174+
$response = $interior->roomDecorator($roomDecoratorSchema);
175+
176+
// Floor Planning
177+
$response = $interior->floorPlanning($floorPlanningSchema);
178+
179+
// Sketch Rendering
180+
$response = $interior->sketchRendering($sketchRenderingSchema);
181+
182+
// Object Removal - Remove objects from room images
183+
$objectRemoval = new ObjectRemovalSchema([
184+
'key' => $apiKey,
185+
'init_image' => 'https://example.com/room.jpg',
186+
'object_name' => 'chair',
187+
'base64' => false
188+
]);
189+
$response = $interior->objectRemoval($objectRemoval);
190+
191+
// Interior Mixer - Add objects from one image into another room
192+
$interiorMixer = new InteriorMixerSchema([
193+
'key' => $apiKey,
194+
'init_image' => 'https://example.com/room.jpg',
195+
'object_image' => 'https://example.com/furniture.jpg',
196+
'prompt' => 'Add the furniture to the living room',
197+
'width' => 1280,
198+
'height' => 1280,
199+
'num_inference_steps' => 8,
200+
'base64' => false
201+
]);
202+
$response = $interior->interiorMixer($interiorMixer);
155203
```
156204

157205
### Realtime API
@@ -187,7 +235,34 @@ Edit and manipulate images.
187235

188236
```php
189237
$imageEditing = $modelslab->imageEditing();
238+
239+
// Qwen Edit - Edit images using Qwen model
240+
$qwenEdit = new QwenEditSchema([
241+
'key' => $apiKey,
242+
'prompt' => 'Add a sunset in the background',
243+
'init_image' => ['https://example.com/image1.jpg', 'https://example.com/image2.jpg'],
244+
'base64' => false
245+
]);
246+
$response = $imageEditing->qwenEdit($qwenEdit);
247+
248+
// Caption - Generate captions for images
249+
$caption = new CaptionSchema([
250+
'key' => $apiKey,
251+
'init_image' => 'https://example.com/image.jpg',
252+
'length' => 'normal', // 'short', 'normal', or 'long'
253+
'base64' => false
254+
]);
255+
$response = $imageEditing->caption($caption);
256+
257+
// Other image editing methods
190258
$response = $imageEditing->backgroundRemover($backgroundRemoverSchema);
259+
$response = $imageEditing->superResolution($superResolutionSchema);
260+
$response = $imageEditing->outpainting($outpaintingSchema);
261+
$response = $imageEditing->inpainting($inpaintingSchema);
262+
$response = $imageEditing->objectRemover($objectRemoverSchema);
263+
$response = $imageEditing->facegen($facegenSchema);
264+
$response = $imageEditing->headshot($headshotSchema);
265+
$response = $imageEditing->fashion($fashionSchema);
191266
```
192267

193268
## Configuration

composer.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"description": "PHP SDK for ModelsLab API - AI-powered image, video, audio, and 3D generation services",
44
"type": "library",
55
"license": "MIT",
6+
"version": "1.2.0",
67
"keywords": ["modelslab", "ai", "sdk", "api", "php", "machine-learning", "text-to-speech", "image-generation", "video-generation", "3d-generation"],
78
"homepage": "https://modelslab.com",
89
"support": {
@@ -15,6 +16,10 @@
1516
"name": "ModelsLab Team",
1617
"email": "support@modelslab.com",
1718
"homepage": "https://modelslab.com"
19+
},
20+
{
21+
"name": "Anurag Kanade",
22+
"email": "anurag@modelslab.com"
1823
}
1924
],
2025
"require": {

src/ModelsLab/Core/Apis/ImageEditing.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
use ModelsLab\Core\Client;
66
use ModelsLab\Schemas\BackgroundRemoverSchema;
7+
use ModelsLab\Schemas\QwenEditSchema;
8+
use ModelsLab\Schemas\CaptionSchema;
79

810
/**
911
* Image Editing API for ModelsLab
@@ -100,4 +102,24 @@ public function fashion(BackgroundRemoverSchema $schema): array
100102
$data = $schema->toArray();
101103
return $this->client->post($baseEndpoint, $data);
102104
}
105+
106+
/**
107+
* Qwen Edit - Edit images using Qwen model
108+
*/
109+
public function qwenEdit(QwenEditSchema $schema): array
110+
{
111+
$baseEndpoint = $this->baseUrl . 'qwen_edit';
112+
$data = $schema->toArray();
113+
return $this->client->post($baseEndpoint, $data);
114+
}
115+
116+
/**
117+
* Caption - Generate captions for images
118+
*/
119+
public function caption(CaptionSchema $schema): array
120+
{
121+
$baseEndpoint = $this->baseUrl . 'caption';
122+
$data = $schema->toArray();
123+
return $this->client->post($baseEndpoint, $data);
124+
}
103125
}

src/ModelsLab/Core/Apis/Interior.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
use ModelsLab\Core\Client;
66
use ModelsLab\Schemas\InteriorSchema;
7+
use ModelsLab\Schemas\ObjectRemovalSchema;
8+
use ModelsLab\Schemas\InteriorMixerSchema;
79

810
/**
911
* Interior API for ModelsLab
@@ -60,4 +62,24 @@ public function sketchRendering(InteriorSchema $schema): array
6062
$data = $schema->toArray();
6163
return $this->client->post($baseEndpoint, $data);
6264
}
65+
66+
/**
67+
* Remove objects from room images
68+
*/
69+
public function objectRemoval(ObjectRemovalSchema $schema): array
70+
{
71+
$baseEndpoint = $this->baseUrl . 'object_removal';
72+
$data = $schema->toArray();
73+
return $this->client->post($baseEndpoint, $data);
74+
}
75+
76+
/**
77+
* Add objects from one image into another room
78+
*/
79+
public function interiorMixer(InteriorMixerSchema $schema): array
80+
{
81+
$baseEndpoint = $this->baseUrl . 'interior_mixer';
82+
$data = $schema->toArray();
83+
return $this->client->post($baseEndpoint, $data);
84+
}
6385
}

src/ModelsLab/Core/Apis/Video.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use ModelsLab\Schemas\Text2Video;
88
use ModelsLab\Schemas\Image2Video;
99
use ModelsLab\Schemas\Text2VideoUltra;
10+
use ModelsLab\Schemas\WatermarkRemoverSchema;
1011

1112
/**
1213
* Video API for ModelsLab
@@ -53,4 +54,14 @@ public function textToVideoUltra(Text2VideoUltra $schema): array
5354
$data = $schema->toArray();
5455
return $this->client->post($baseEndpoint, $data);
5556
}
57+
58+
/**
59+
* Remove watermarks from videos
60+
*/
61+
public function watermarkRemover(WatermarkRemoverSchema $schema): array
62+
{
63+
$baseEndpoint = $this->baseUrl . 'watermark_remover';
64+
$data = $schema->toArray();
65+
return $this->client->post($baseEndpoint, $data);
66+
}
5667
}

src/ModelsLab/Schemas/ImageEditing.php

Lines changed: 86 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,105 @@ class BackgroundRemoverSchema extends BaseSchema
99
{
1010
protected $image;
1111
protected ?bool $base64;
12-
12+
1313
public function __construct(array $data = [])
1414
{
1515
parent::__construct($data);
16-
16+
1717
$this->image = $data['image'] ?? null;
1818
$this->base64 = $data['base64'] ?? null;
1919
}
20-
20+
2121
public function getImage()
2222
{
2323
return $this->image;
2424
}
25-
25+
2626
public function setImage($image): self
2727
{
2828
$this->image = $image;
2929
return $this;
3030
}
3131
}
32+
33+
/**
34+
* Qwen Edit schema
35+
*/
36+
class QwenEditSchema extends BaseSchema
37+
{
38+
protected $prompt;
39+
protected $init_image;
40+
protected ?bool $base64;
41+
42+
public function __construct(array $data = [])
43+
{
44+
parent::__construct($data);
45+
46+
$this->prompt = $data['prompt'] ?? null;
47+
$this->init_image = $data['init_image'] ?? null;
48+
$this->base64 = $data['base64'] ?? false;
49+
}
50+
51+
public function getPrompt()
52+
{
53+
return $this->prompt;
54+
}
55+
56+
public function setPrompt($prompt): self
57+
{
58+
$this->prompt = $prompt;
59+
return $this;
60+
}
61+
62+
public function getInitImage()
63+
{
64+
return $this->init_image;
65+
}
66+
67+
public function setInitImage($init_image): self
68+
{
69+
$this->init_image = $init_image;
70+
return $this;
71+
}
72+
}
73+
74+
/**
75+
* Caption schema
76+
*/
77+
class CaptionSchema extends BaseSchema
78+
{
79+
protected $init_image;
80+
protected ?string $length;
81+
protected ?bool $base64;
82+
83+
public function __construct(array $data = [])
84+
{
85+
parent::__construct($data);
86+
87+
$this->init_image = $data['init_image'] ?? null;
88+
$this->length = $data['length'] ?? 'normal';
89+
$this->base64 = $data['base64'] ?? false;
90+
}
91+
92+
public function getInitImage()
93+
{
94+
return $this->init_image;
95+
}
96+
97+
public function setInitImage($init_image): self
98+
{
99+
$this->init_image = $init_image;
100+
return $this;
101+
}
102+
103+
public function getLength()
104+
{
105+
return $this->length;
106+
}
107+
108+
public function setLength($length): self
109+
{
110+
$this->length = $length;
111+
return $this;
112+
}
113+
}

0 commit comments

Comments
 (0)