Yw22 commited on
Commit
fec6b2f
1 Parent(s): 3954839
Files changed (2) hide show
  1. app-23.py → app-12.py +64 -65
  2. app.py +65 -64
app-23.py → app-12.py RENAMED
@@ -150,70 +150,69 @@ image_examples = [
150
  "object",
151
  11318446767408804497,
152
  "",
153
- "__asset__/images/object/turtle-1.jpg",
154
- json.load(open("__asset__/trajs/object/turtle-1.json"))
155
  ],
156
 
157
- # ["__asset__/images/object/rose-1.jpg",
158
- # "a red rose engulfed in flames.",
159
- # "object",
160
- # 6854275249656120509,
161
- # "",
162
- # "rose",
163
- # ],
164
 
165
- # ["__asset__/images/object/jellyfish-1.jpg",
166
- # "intricate detailing,photorealism,hyperrealistic, glowing jellyfish mushroom, flying, starry sky, bokeh, golden ratio composition.",
167
- # "object",
168
- # 17966188172968903484,
169
- # "HelloObject",
170
- # "jellyfish"
171
- # ],
172
 
173
 
174
- # ["__asset__/images/camera/lush-1.jpg",
175
- # "detailed craftsmanship, photorealism, hyperrealistic, roaring waterfall, misty spray, lush greenery, vibrant rainbow, golden ratio composition.",
176
- # "camera",
177
- # 7970487946960948963,
178
- # "HelloObject",
179
- # "lush",
180
- # ],
181
 
182
- # ["__asset__/images/camera/tusun-1.jpg",
183
- # "tusuncub with its mouth open, blurry, open mouth, fangs, photo background, looking at viewer, tongue, full body, solo, cute and lovely, Beautiful and realistic eye details, perfect anatomy, Nonsense, pure background, Centered-Shot, realistic photo, photograph, 4k, hyper detailed, DSLR, 24 Megapixels, 8mm Lens, Full Frame, film grain, Global Illumination, studio Lighting, Award Winning Photography, diffuse reflection, ray tracing.",
184
- # "camera",
185
- # 996953226890228361,
186
- # "TUSUN",
187
- # "tusun",
188
- # ],
189
 
190
- # ["__asset__/images/camera/painting-1.jpg",
191
- # "A oil painting.",
192
- # "camera",
193
- # 16867854766769816385,
194
- # "",
195
- # "painting"
196
- # ],
197
  ]
198
 
199
 
200
- # POINTS = {
201
- # 'turtle': "__asset__/trajs/object/turtle-1.json",
202
- # 'rose': "__asset__/trajs/object/rose-1.json",
203
- # 'jellyfish': "__asset__/trajs/object/jellyfish-1.json",
204
- # 'lush': "__asset__/trajs/camera/lush-1.json",
205
- # 'tusun': "__asset__/trajs/camera/tusun-1.json",
206
- # 'painting': "__asset__/trajs/camera/painting-1.json",
207
- # }
208
 
209
- # IMAGE_PATH = {
210
- # 'turtle': "__asset__/images/object/turtle-1.jpg",
211
- # 'rose': "__asset__/images/object/rose-1.jpg",
212
- # 'jellyfish': "__asset__/images/object/jellyfish-1.jpg",
213
- # 'lush': "__asset__/images/camera/lush-1.jpg",
214
- # 'tusun': "__asset__/images/camera/tusun-1.jpg",
215
- # 'painting': "__asset__/images/camera/painting-1.jpg",
216
- # }
217
 
218
 
219
 
@@ -301,17 +300,17 @@ class ImageConductor:
301
 
302
  self.blur_kernel = blur_kernel
303
 
304
- @spaces.GPU(duration=20)
305
  def run(self, first_frame_path, tracking_points, prompt, drag_mode, negative_prompt, seed, randomize_seed, guidance_scale, num_inference_steps, personalized, examples_type):
306
  print("Run!")
307
- # if examples_type != "":
308
- # ### for adapting high version gradio
309
- # tracking_points = gr.State([])
310
- # first_frame_path = IMAGE_PATH[examples_type]
311
- # points = json.load(open(POINTS[examples_type]))
312
- # tracking_points.value.extend(points)
313
- # print("example first_frame_path", first_frame_path)
314
- # print("example tracking_points", tracking_points.value)
315
 
316
  original_width, original_height=384, 256
317
  if isinstance(tracking_points, list):
@@ -321,7 +320,7 @@ class ImageConductor:
321
 
322
  print("input_all_points", input_all_points)
323
  resized_all_points = [tuple([tuple([float(e1[0]*self.width/original_width), float(e1[1]*self.height/original_height)]) for e1 in e]) for e in input_all_points]
324
- print("first_frame_path", first_frame_path)
325
  dir, base, ext = split_filename(first_frame_path)
326
  id = base.split('_')[-1]
327
 
@@ -568,7 +567,7 @@ with block:
568
  width=384,
569
  model_length=16
570
  )
571
- first_frame_path_var = gr.State()
572
  tracking_points_var = gr.State([])
573
 
574
  with gr.Row():
@@ -649,7 +648,7 @@ with block:
649
  example = gr.Examples(
650
  label="Input Example",
651
  examples=image_examples,
652
- inputs=[input_image, prompt, drag_mode, seed, personalized, first_frame_path_var, tracking_points_var],
653
  examples_per_page=10,
654
  cache_examples=False,
655
  )
 
150
  "object",
151
  11318446767408804497,
152
  "",
153
+ "turtle"
 
154
  ],
155
 
156
+ ["__asset__/images/object/rose-1.jpg",
157
+ "a red rose engulfed in flames.",
158
+ "object",
159
+ 6854275249656120509,
160
+ "",
161
+ "rose",
162
+ ],
163
 
164
+ ["__asset__/images/object/jellyfish-1.jpg",
165
+ "intricate detailing,photorealism,hyperrealistic, glowing jellyfish mushroom, flying, starry sky, bokeh, golden ratio composition.",
166
+ "object",
167
+ 17966188172968903484,
168
+ "HelloObject",
169
+ "jellyfish"
170
+ ],
171
 
172
 
173
+ ["__asset__/images/camera/lush-1.jpg",
174
+ "detailed craftsmanship, photorealism, hyperrealistic, roaring waterfall, misty spray, lush greenery, vibrant rainbow, golden ratio composition.",
175
+ "camera",
176
+ 7970487946960948963,
177
+ "HelloObject",
178
+ "lush",
179
+ ],
180
 
181
+ ["__asset__/images/camera/tusun-1.jpg",
182
+ "tusuncub with its mouth open, blurry, open mouth, fangs, photo background, looking at viewer, tongue, full body, solo, cute and lovely, Beautiful and realistic eye details, perfect anatomy, Nonsense, pure background, Centered-Shot, realistic photo, photograph, 4k, hyper detailed, DSLR, 24 Megapixels, 8mm Lens, Full Frame, film grain, Global Illumination, studio Lighting, Award Winning Photography, diffuse reflection, ray tracing.",
183
+ "camera",
184
+ 996953226890228361,
185
+ "TUSUN",
186
+ "tusun",
187
+ ],
188
 
189
+ ["__asset__/images/camera/painting-1.jpg",
190
+ "A oil painting.",
191
+ "camera",
192
+ 16867854766769816385,
193
+ "",
194
+ "painting"
195
+ ],
196
  ]
197
 
198
 
199
+ POINTS = {
200
+ 'turtle': "__asset__/trajs/object/turtle-1.json",
201
+ 'rose': "__asset__/trajs/object/rose-1.json",
202
+ 'jellyfish': "__asset__/trajs/object/jellyfish-1.json",
203
+ 'lush': "__asset__/trajs/camera/lush-1.json",
204
+ 'tusun': "__asset__/trajs/camera/tusun-1.json",
205
+ 'painting': "__asset__/trajs/camera/painting-1.json",
206
+ }
207
 
208
+ IMAGE_PATH = {
209
+ 'turtle': "__asset__/images/object/turtle-1.jpg",
210
+ 'rose': "__asset__/images/object/rose-1.jpg",
211
+ 'jellyfish': "__asset__/images/object/jellyfish-1.jpg",
212
+ 'lush': "__asset__/images/camera/lush-1.jpg",
213
+ 'tusun': "__asset__/images/camera/tusun-1.jpg",
214
+ 'painting': "__asset__/images/camera/painting-1.jpg",
215
+ }
216
 
217
 
218
 
 
300
 
301
  self.blur_kernel = blur_kernel
302
 
303
+ @spaces.GPU(duration=180)
304
  def run(self, first_frame_path, tracking_points, prompt, drag_mode, negative_prompt, seed, randomize_seed, guidance_scale, num_inference_steps, personalized, examples_type):
305
  print("Run!")
306
+ if examples_type != "":
307
+ ### for adapting high version gradio
308
+ tracking_points = gr.State([])
309
+ first_frame_path = IMAGE_PATH[examples_type]
310
+ points = json.load(open(POINTS[examples_type]))
311
+ tracking_points.value.extend(points)
312
+ print("example first_frame_path", first_frame_path)
313
+ print("example tracking_points", tracking_points.value)
314
 
315
  original_width, original_height=384, 256
316
  if isinstance(tracking_points, list):
 
320
 
321
  print("input_all_points", input_all_points)
322
  resized_all_points = [tuple([tuple([float(e1[0]*self.width/original_width), float(e1[1]*self.height/original_height)]) for e1 in e]) for e in input_all_points]
323
+
324
  dir, base, ext = split_filename(first_frame_path)
325
  id = base.split('_')[-1]
326
 
 
567
  width=384,
568
  model_length=16
569
  )
570
+ first_frame_path_var = gr.State(value=None)
571
  tracking_points_var = gr.State([])
572
 
573
  with gr.Row():
 
648
  example = gr.Examples(
649
  label="Input Example",
650
  examples=image_examples,
651
+ inputs=[input_image, prompt, drag_mode, seed, personalized, examples_type],
652
  examples_per_page=10,
653
  cache_examples=False,
654
  )
app.py CHANGED
@@ -150,69 +150,70 @@ image_examples = [
150
  "object",
151
  11318446767408804497,
152
  "",
153
- "turtle"
 
154
  ],
155
 
156
- ["__asset__/images/object/rose-1.jpg",
157
- "a red rose engulfed in flames.",
158
- "object",
159
- 6854275249656120509,
160
- "",
161
- "rose",
162
- ],
163
 
164
- ["__asset__/images/object/jellyfish-1.jpg",
165
- "intricate detailing,photorealism,hyperrealistic, glowing jellyfish mushroom, flying, starry sky, bokeh, golden ratio composition.",
166
- "object",
167
- 17966188172968903484,
168
- "HelloObject",
169
- "jellyfish"
170
- ],
171
 
172
 
173
- ["__asset__/images/camera/lush-1.jpg",
174
- "detailed craftsmanship, photorealism, hyperrealistic, roaring waterfall, misty spray, lush greenery, vibrant rainbow, golden ratio composition.",
175
- "camera",
176
- 7970487946960948963,
177
- "HelloObject",
178
- "lush",
179
- ],
180
 
181
- ["__asset__/images/camera/tusun-1.jpg",
182
- "tusuncub with its mouth open, blurry, open mouth, fangs, photo background, looking at viewer, tongue, full body, solo, cute and lovely, Beautiful and realistic eye details, perfect anatomy, Nonsense, pure background, Centered-Shot, realistic photo, photograph, 4k, hyper detailed, DSLR, 24 Megapixels, 8mm Lens, Full Frame, film grain, Global Illumination, studio Lighting, Award Winning Photography, diffuse reflection, ray tracing.",
183
- "camera",
184
- 996953226890228361,
185
- "TUSUN",
186
- "tusun",
187
- ],
188
 
189
- ["__asset__/images/camera/painting-1.jpg",
190
- "A oil painting.",
191
- "camera",
192
- 16867854766769816385,
193
- "",
194
- "painting"
195
- ],
196
  ]
197
 
198
 
199
- POINTS = {
200
- 'turtle': "__asset__/trajs/object/turtle-1.json",
201
- 'rose': "__asset__/trajs/object/rose-1.json",
202
- 'jellyfish': "__asset__/trajs/object/jellyfish-1.json",
203
- 'lush': "__asset__/trajs/camera/lush-1.json",
204
- 'tusun': "__asset__/trajs/camera/tusun-1.json",
205
- 'painting': "__asset__/trajs/camera/painting-1.json",
206
- }
207
 
208
- IMAGE_PATH = {
209
- 'turtle': "__asset__/images/object/turtle-1.jpg",
210
- 'rose': "__asset__/images/object/rose-1.jpg",
211
- 'jellyfish': "__asset__/images/object/jellyfish-1.jpg",
212
- 'lush': "__asset__/images/camera/lush-1.jpg",
213
- 'tusun': "__asset__/images/camera/tusun-1.jpg",
214
- 'painting': "__asset__/images/camera/painting-1.jpg",
215
- }
216
 
217
 
218
 
@@ -300,17 +301,17 @@ class ImageConductor:
300
 
301
  self.blur_kernel = blur_kernel
302
 
303
- @spaces.GPU(duration=180)
304
  def run(self, first_frame_path, tracking_points, prompt, drag_mode, negative_prompt, seed, randomize_seed, guidance_scale, num_inference_steps, personalized, examples_type):
305
  print("Run!")
306
- if examples_type != "":
307
- ### for adapting high version gradio
308
- tracking_points = gr.State([])
309
- first_frame_path = IMAGE_PATH[examples_type]
310
- points = json.load(open(POINTS[examples_type]))
311
- tracking_points.value.extend(points)
312
- print("example first_frame_path", first_frame_path)
313
- print("example tracking_points", tracking_points.value)
314
 
315
  original_width, original_height=384, 256
316
  if isinstance(tracking_points, list):
@@ -320,7 +321,7 @@ class ImageConductor:
320
 
321
  print("input_all_points", input_all_points)
322
  resized_all_points = [tuple([tuple([float(e1[0]*self.width/original_width), float(e1[1]*self.height/original_height)]) for e1 in e]) for e in input_all_points]
323
-
324
  dir, base, ext = split_filename(first_frame_path)
325
  id = base.split('_')[-1]
326
 
@@ -567,7 +568,7 @@ with block:
567
  width=384,
568
  model_length=16
569
  )
570
- first_frame_path_var = gr.State(value=None)
571
  tracking_points_var = gr.State([])
572
 
573
  with gr.Row():
@@ -648,7 +649,7 @@ with block:
648
  example = gr.Examples(
649
  label="Input Example",
650
  examples=image_examples,
651
- inputs=[input_image, prompt, drag_mode, seed, personalized, examples_type],
652
  examples_per_page=10,
653
  cache_examples=False,
654
  )
 
150
  "object",
151
  11318446767408804497,
152
  "",
153
+ "__asset__/images/object/turtle-1.jpg",
154
+ json.load(open("__asset__/trajs/object/turtle-1.json"))
155
  ],
156
 
157
+ # ["__asset__/images/object/rose-1.jpg",
158
+ # "a red rose engulfed in flames.",
159
+ # "object",
160
+ # 6854275249656120509,
161
+ # "",
162
+ # "rose",
163
+ # ],
164
 
165
+ # ["__asset__/images/object/jellyfish-1.jpg",
166
+ # "intricate detailing,photorealism,hyperrealistic, glowing jellyfish mushroom, flying, starry sky, bokeh, golden ratio composition.",
167
+ # "object",
168
+ # 17966188172968903484,
169
+ # "HelloObject",
170
+ # "jellyfish"
171
+ # ],
172
 
173
 
174
+ # ["__asset__/images/camera/lush-1.jpg",
175
+ # "detailed craftsmanship, photorealism, hyperrealistic, roaring waterfall, misty spray, lush greenery, vibrant rainbow, golden ratio composition.",
176
+ # "camera",
177
+ # 7970487946960948963,
178
+ # "HelloObject",
179
+ # "lush",
180
+ # ],
181
 
182
+ # ["__asset__/images/camera/tusun-1.jpg",
183
+ # "tusuncub with its mouth open, blurry, open mouth, fangs, photo background, looking at viewer, tongue, full body, solo, cute and lovely, Beautiful and realistic eye details, perfect anatomy, Nonsense, pure background, Centered-Shot, realistic photo, photograph, 4k, hyper detailed, DSLR, 24 Megapixels, 8mm Lens, Full Frame, film grain, Global Illumination, studio Lighting, Award Winning Photography, diffuse reflection, ray tracing.",
184
+ # "camera",
185
+ # 996953226890228361,
186
+ # "TUSUN",
187
+ # "tusun",
188
+ # ],
189
 
190
+ # ["__asset__/images/camera/painting-1.jpg",
191
+ # "A oil painting.",
192
+ # "camera",
193
+ # 16867854766769816385,
194
+ # "",
195
+ # "painting"
196
+ # ],
197
  ]
198
 
199
 
200
+ # POINTS = {
201
+ # 'turtle': "__asset__/trajs/object/turtle-1.json",
202
+ # 'rose': "__asset__/trajs/object/rose-1.json",
203
+ # 'jellyfish': "__asset__/trajs/object/jellyfish-1.json",
204
+ # 'lush': "__asset__/trajs/camera/lush-1.json",
205
+ # 'tusun': "__asset__/trajs/camera/tusun-1.json",
206
+ # 'painting': "__asset__/trajs/camera/painting-1.json",
207
+ # }
208
 
209
+ # IMAGE_PATH = {
210
+ # 'turtle': "__asset__/images/object/turtle-1.jpg",
211
+ # 'rose': "__asset__/images/object/rose-1.jpg",
212
+ # 'jellyfish': "__asset__/images/object/jellyfish-1.jpg",
213
+ # 'lush': "__asset__/images/camera/lush-1.jpg",
214
+ # 'tusun': "__asset__/images/camera/tusun-1.jpg",
215
+ # 'painting': "__asset__/images/camera/painting-1.jpg",
216
+ # }
217
 
218
 
219
 
 
301
 
302
  self.blur_kernel = blur_kernel
303
 
304
+ @spaces.GPU(duration=20)
305
  def run(self, first_frame_path, tracking_points, prompt, drag_mode, negative_prompt, seed, randomize_seed, guidance_scale, num_inference_steps, personalized, examples_type):
306
  print("Run!")
307
+ # if examples_type != "":
308
+ # ### for adapting high version gradio
309
+ # tracking_points = gr.State([])
310
+ # first_frame_path = IMAGE_PATH[examples_type]
311
+ # points = json.load(open(POINTS[examples_type]))
312
+ # tracking_points.value.extend(points)
313
+ # print("example first_frame_path", first_frame_path)
314
+ # print("example tracking_points", tracking_points.value)
315
 
316
  original_width, original_height=384, 256
317
  if isinstance(tracking_points, list):
 
321
 
322
  print("input_all_points", input_all_points)
323
  resized_all_points = [tuple([tuple([float(e1[0]*self.width/original_width), float(e1[1]*self.height/original_height)]) for e1 in e]) for e in input_all_points]
324
+ print("first_frame_path", first_frame_path)
325
  dir, base, ext = split_filename(first_frame_path)
326
  id = base.split('_')[-1]
327
 
 
568
  width=384,
569
  model_length=16
570
  )
571
+ first_frame_path_var = gr.State()
572
  tracking_points_var = gr.State([])
573
 
574
  with gr.Row():
 
649
  example = gr.Examples(
650
  label="Input Example",
651
  examples=image_examples,
652
+ inputs=[input_image, prompt, drag_mode, seed, personalized, first_frame_path_var, tracking_points_var],
653
  examples_per_page=10,
654
  cache_examples=False,
655
  )