Ryan1122 commited on
Commit
1cf6b00
·
verified ·
1 Parent(s): cf13162

Keep editing prompt unchanged and retain adaptive selection

Browse files
README.md CHANGED
@@ -180,7 +180,7 @@ Provide the following inputs:
180
  | --- | --- |
181
  | `user_query` | The editing instruction. Refer to images in their supplied order. |
182
  | `references` | At least one prepared image, in order, with its original display aspect ratio as a reduced `W:H` string. Use `None` when the source ratio is unknown. |
183
- | `aspect_ratio` | The target ratio: `auto` to let the model choose, or an explicit positive-integer `W:H` string. |
184
 
185
  ### Assemble the message
186
 
@@ -202,7 +202,7 @@ from pathlib import Path
202
 
203
  task_prompt = Path("prompt/edit/task_prompt.txt").read_text(encoding="utf-8")
204
  user_query = "Replace the bag in the first image with the bag in the second image."
205
- aspect_ratio = "auto" # Or an explicit ratio, such as "16:9".
206
  references = [
207
  {"image": source_image, "aspect_ratio": "3:2"},
208
  {"image": reference_image, "aspect_ratio": "1:1"},
@@ -249,4 +249,4 @@ The description identifies source subjects, states what is preserved or changed,
249
  and describes new content. Descriptive prose is English; literal text retains the
250
  language you request. `target_aspect_ratio` is a positive-integer `W:H` string.
251
  If you select an explicit ratio, the model preserves it exactly. If you select
252
- `auto`, the model determines a numeric ratio for the intended edited image.
 
180
  | --- | --- |
181
  | `user_query` | The editing instruction. Refer to images in their supplied order. |
182
  | `references` | At least one prepared image, in order, with its original display aspect ratio as a reduced `W:H` string. Use `None` when the source ratio is unknown. |
183
+ | `aspect_ratio` | The target ratio: `adaptive` to let the model choose, or an explicit positive-integer `W:H` string. |
184
 
185
  ### Assemble the message
186
 
 
202
 
203
  task_prompt = Path("prompt/edit/task_prompt.txt").read_text(encoding="utf-8")
204
  user_query = "Replace the bag in the first image with the bag in the second image."
205
+ aspect_ratio = "adaptive" # Or an explicit ratio, such as "16:9".
206
  references = [
207
  {"image": source_image, "aspect_ratio": "3:2"},
208
  {"image": reference_image, "aspect_ratio": "1:1"},
 
249
  and describes new content. Descriptive prose is English; literal text retains the
250
  language you request. `target_aspect_ratio` is a positive-integer `W:H` string.
251
  If you select an explicit ratio, the model preserves it exactly. If you select
252
+ `adaptive`, the model determines a numeric ratio for the intended edited image.
prompt/edit/task_prompt.txt CHANGED
@@ -3,7 +3,7 @@ You are an expert at enhancing a short image-editing instruction into a rich, vi
3
  ## What you are given
4
  - Input image(s), labeled sequentially starting from <Picture 1>. These are the user's source and reference images.
5
  - One short editing instruction. It may be terse, vague, informal, or phrased as a desired result rather than an imperative. The final text part supplies it as User Editing Instruction (JSON string).
6
- - User Aspect Ratio Selection: any concrete positive-integer W:H ratio, or auto, supplied in the final text part.
7
  - Each input image is immediately preceded by a Reference Media text part containing its <Picture N> label and aspect_ratio W:H. The caller has already reduced the image's original display width and height to their exact lowest integer ratio, after EXIF orientation and before preview resizing or padding. No pixel dimensions are supplied in this metadata. The ratio applies only to the immediately following image. The supplied aspect_ratio is the reference image's exact ratio, not necessarily the final target ratio. Use it as given; do not estimate the source ratio from the preview. Determine the final target ratio using the rules below. If the original dimensions are unknown, the metadata says aspect_ratio unavailable.
8
  - There is no target image. Construct the intended target from the visible source evidence and the instruction; never pretend to have observed a hidden result.
9
 
@@ -22,8 +22,8 @@ Read User Aspect Ratio Selection from the final input part.
22
  Specified ratio:
23
  If a concrete ratio is supplied, copy that exact string to target_aspect_ratio. Any positive-integer W:H ratio is allowed; it is not limited to a preset list. Neither the editing instruction nor a reference image may override it.
24
 
25
- Auto mode:
26
- Only when the selection is auto, determine the aspect ratio of the intended finished target image, which may differ from the main reference image. Apply these rules in order:
27
 
28
  1. Follow an explicit final target ratio or target dimensions in the editing instruction. Use the requested final geometry rather than source or earlier geometry. Exact numeric geometry takes precedence over generic orientation. When only a final orientation is specified, use 21:9 for ultra-wide, 16:9 for landscape, 1:1 for square, and 9:16 for portrait.
29
 
@@ -41,7 +41,7 @@ Only when the selection is auto, determine the aspect ratio of the intended fini
41
 
42
  Apply these rules to the whole target canvas. Grid row/column counts, individual panels, objects inside the image, and literal text are not whole-canvas ratio requests. A portrait subject or wide-angle lens alone is not a target-orientation request. Do not use a reference board's ratio as the ratio of one panel.
43
 
44
- Serialize target_aspect_ratio as two positive integers in W:H form, with no spaces; never output auto. Preserve concrete user selections, explicit positive-integer target ratios in the instruction, and unchanged reference ratios exactly. Convert other explicit numeric ratios or target dimensions to their exact reduced integer ratio; reduce newly calculated or chosen ratios to their lowest integer form. Do not snap to preset ratios or clamp to a supported range.
45
 
46
  Later descriptive additions must not change the chosen ratio. Pixel-size resolution, 32 alignment, and downstream size fallback are outside this task.
47
 
@@ -185,7 +185,7 @@ Before answering, verify:
185
  - all non-literal descriptive and relationship prose is English, while quoted source, user-specified, or newly authored requested text uses its required language and script;
186
  - any grid layout described makes the row count and column count unambiguous, either in words or with explicitly labeled multiplication notation, with positions or uneven-row structure clarified where needed;
187
  - expanded_caption is one fluent, complete paragraph with no structural meta-language in the narration; multi-line literals retain their wording, reading order, and intended line boundaries through inline quoted lines;
188
- - target_aspect_ratio copies any concrete user selection exactly; in auto mode, it preserves the main reference ratio when no canvas-shape change is required and reflects any requested expansion or cropping; expanded_caption and its preservation relationships agree with the final canvas;
189
  - the final answer is a valid JSON object containing only the two string fields target_aspect_ratio and expanded_caption.
190
 
191
  Output only the required two-field JSON object.
 
3
  ## What you are given
4
  - Input image(s), labeled sequentially starting from <Picture 1>. These are the user's source and reference images.
5
  - One short editing instruction. It may be terse, vague, informal, or phrased as a desired result rather than an imperative. The final text part supplies it as User Editing Instruction (JSON string).
6
+ - User Aspect Ratio Selection: any concrete positive-integer W:H ratio, or adaptive, supplied in the final text part.
7
  - Each input image is immediately preceded by a Reference Media text part containing its <Picture N> label and aspect_ratio W:H. The caller has already reduced the image's original display width and height to their exact lowest integer ratio, after EXIF orientation and before preview resizing or padding. No pixel dimensions are supplied in this metadata. The ratio applies only to the immediately following image. The supplied aspect_ratio is the reference image's exact ratio, not necessarily the final target ratio. Use it as given; do not estimate the source ratio from the preview. Determine the final target ratio using the rules below. If the original dimensions are unknown, the metadata says aspect_ratio unavailable.
8
  - There is no target image. Construct the intended target from the visible source evidence and the instruction; never pretend to have observed a hidden result.
9
 
 
22
  Specified ratio:
23
  If a concrete ratio is supplied, copy that exact string to target_aspect_ratio. Any positive-integer W:H ratio is allowed; it is not limited to a preset list. Neither the editing instruction nor a reference image may override it.
24
 
25
+ Adaptive mode:
26
+ Only when the selection is adaptive, determine the aspect ratio of the intended finished target image, which may differ from the main reference image. Apply these rules in order:
27
 
28
  1. Follow an explicit final target ratio or target dimensions in the editing instruction. Use the requested final geometry rather than source or earlier geometry. Exact numeric geometry takes precedence over generic orientation. When only a final orientation is specified, use 21:9 for ultra-wide, 16:9 for landscape, 1:1 for square, and 9:16 for portrait.
29
 
 
41
 
42
  Apply these rules to the whole target canvas. Grid row/column counts, individual panels, objects inside the image, and literal text are not whole-canvas ratio requests. A portrait subject or wide-angle lens alone is not a target-orientation request. Do not use a reference board's ratio as the ratio of one panel.
43
 
44
+ Serialize target_aspect_ratio as two positive integers in W:H form, with no spaces; never output adaptive. Preserve concrete user selections, explicit positive-integer target ratios in the instruction, and unchanged reference ratios exactly. Convert other explicit numeric ratios or target dimensions to their exact reduced integer ratio; reduce newly calculated or chosen ratios to their lowest integer form. Do not snap to preset ratios or clamp to a supported range.
45
 
46
  Later descriptive additions must not change the chosen ratio. Pixel-size resolution, 32 alignment, and downstream size fallback are outside this task.
47
 
 
185
  - all non-literal descriptive and relationship prose is English, while quoted source, user-specified, or newly authored requested text uses its required language and script;
186
  - any grid layout described makes the row count and column count unambiguous, either in words or with explicitly labeled multiplication notation, with positions or uneven-row structure clarified where needed;
187
  - expanded_caption is one fluent, complete paragraph with no structural meta-language in the narration; multi-line literals retain their wording, reading order, and intended line boundaries through inline quoted lines;
188
+ - target_aspect_ratio copies any concrete user selection exactly; in adaptive mode, it preserves the main reference ratio when no canvas-shape change is required and reflects any requested expansion or cropping; expanded_caption and its preservation relationships agree with the final canvas;
189
  - the final answer is a valid JSON object containing only the two string fields target_aspect_ratio and expanded_caption.
190
 
191
  Output only the required two-field JSON object.
prompt/manifest.json CHANGED
@@ -15,7 +15,7 @@
15
  "edit": {
16
  "files": {
17
  "prompt/edit/task_prompt.txt": {
18
- "sha256": "8aafd512c4ac61e9cbc2a6e9a23c23f4dff2495886b48f663578e6330e01fce5"
19
  }
20
  }
21
  }
 
15
  "edit": {
16
  "files": {
17
  "prompt/edit/task_prompt.txt": {
18
+ "sha256": "c5695dbfc07a9e65555cef67d92467c613371cc2039b96f057022246a30a57b2"
19
  }
20
  }
21
  }