rootglitch commited on
Commit
bb96f4c
·
1 Parent(s): cdf05c6

Changed to iclight

Browse files
Files changed (1) hide show
  1. app.py +42 -13
app.py CHANGED
@@ -464,20 +464,49 @@ def generate_ai_bg(input_img, prompt):
464
  # input_img = resize_image(input_img, 0.01)
465
  hf_input_img = encode_image(input_img)
466
 
467
- handler = fal_client.submit(
468
- "fal-ai/iclight-v2",
469
- arguments={
470
- "prompt": prompt,
471
- "image_url": hf_input_img
472
- },
473
- webhook_url="https://optional.webhook.url/for/results",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
474
  )
475
-
476
- request_id = handler.request_id
477
-
478
- status = fal_client.status("fal-ai/iclight-v2", request_id, with_logs=True)
479
-
480
- result = fal_client.result("fal-ai/iclight-v2", request_id)
481
 
482
  relight_img_path = result['images'][0]['url']
483
 
 
464
  # input_img = resize_image(input_img, 0.01)
465
  hf_input_img = encode_image(input_img)
466
 
467
+ # handler = fal_client.submit(
468
+ # "fal-ai/iclight-v2",
469
+ # arguments={
470
+ # "prompt": prompt,
471
+ # "image_url": hf_input_img
472
+ # },
473
+ # webhook_url="https://optional.webhook.url/for/results",
474
+ # )
475
+
476
+ # request_id = handler.request_id
477
+
478
+ # status = fal_client.status("fal-ai/iclight-v2", request_id, with_logs=True)
479
+
480
+ # result = fal_client.result("fal-ai/iclight-v2", request_id)
481
+
482
+ # relight_img_path = result['images'][0]['url']
483
+
484
+ # response = requests.get(relight_img_path, stream=True)
485
+
486
+ # relight_img = Image.open(BytesIO(response.content)).convert("RGBA")
487
+
488
+ from gradio_client import Client, handle_file
489
+
490
+ client = Client("lllyasviel/iclight-v2-vary")
491
+ result = client.predict(
492
+ input_fg=handle_file(hf_input_img),
493
+ bg_source="None",
494
+ prompt=prompt,
495
+ image_width=896,
496
+ image_height=1152,
497
+ num_samples=1,
498
+ seed=12345,
499
+ steps=25,
500
+ n_prompt="lowres, bad anatomy, bad hands, cropped, worst quality",
501
+ cfg=2,
502
+ gs=5,
503
+ enable_hr_fix=True,
504
+ hr_downscale=0.5,
505
+ lowres_denoise=0.8,
506
+ highres_denoise=0.99,
507
+ api_name="/process"
508
  )
509
+ print(result)
 
 
 
 
 
510
 
511
  relight_img_path = result['images'][0]['url']
512