fffiloni commited on
Commit
a03ca79
1 Parent(s): 9d8f76a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -6,9 +6,9 @@ hf_token = os.environ.get("HF_TKN")
6
 
7
  from style_template import styles
8
  STYLE_NAMES = list(styles.keys())
9
- DEFAULT_STYLE_NAME = "Watercolor"
10
 
11
- def get_instantID(portrait_in, condition_pose, prompt):
12
  client = Client("https://fffiloni-instantid.hf.space/", hf_token=hf_token)
13
  negative_prompt = "(lowres, low quality, worst quality:1.2), (text:1.2), watermark, (frame:1.2), deformed, ugly, deformed eyes, blur, out of focus, blurry, deformed cat, deformed, photo, anthropomorphic cat, monochrome, photo, pet collar, gun, weapon, blue, 3d, drones, drone, buildings in background, green"
14
  result = client.predict(
@@ -16,7 +16,7 @@ def get_instantID(portrait_in, condition_pose, prompt):
16
  condition_pose, # filepath in 'Upload a reference pose image (optional)' Image component
17
  prompt, # str in 'Prompt' Textbox component
18
  negative_prompt, # str in 'Negative Prompt' Textbox component
19
- "(No style)", # Literal['(No style)', 'Watercolor', 'Film Noir', 'Neon', 'Jungle', 'Mars', 'Vibrant Color', 'Snow', 'Line art'] in 'Style template' Dropdown component
20
  True, # bool in 'Enhance non-face region' Checkbox component
21
  20, # float (numeric value between 20 and 100) in 'Number of sample steps' Slider component
22
  0.8, # float (numeric value between 0 and 1.5) in 'IdentityNet strength (for fedility)' Slider component
@@ -54,7 +54,7 @@ def get_video_svd(image_in):
54
  print(result)
55
  return result[0]["video"]
56
 
57
- def infer(image_in, camera_shot, conditional_pose, prompt, chosen_model):
58
  if camera_shot == "custom":
59
  if conditional_pose != None:
60
  conditional_pose = conditional_pose
@@ -74,7 +74,7 @@ def infer(image_in, camera_shot, conditional_pose, prompt, chosen_model):
74
  elif camera_shot == "full shot":
75
  conditional_pose = "camera_shots/full_shot.jpeg"
76
 
77
- iid_img = get_instantID(image_in, conditional_pose, prompt)
78
 
79
  if chosen_model == "i2vgen-xl" :
80
  video_res = get_video_i2vgen(iid_img, prompt)
@@ -134,6 +134,7 @@ with gr.Blocks(css=css) as demo:
134
  camera_shot,
135
  condition_shot,
136
  prompt,
 
137
  chosen_model
138
  ],
139
  outputs = [
 
6
 
7
  from style_template import styles
8
  STYLE_NAMES = list(styles.keys())
9
+ DEFAULT_STYLE_NAME = "(No Style)"
10
 
11
+ def get_instantID(portrait_in, condition_pose, prompt, style):
12
  client = Client("https://fffiloni-instantid.hf.space/", hf_token=hf_token)
13
  negative_prompt = "(lowres, low quality, worst quality:1.2), (text:1.2), watermark, (frame:1.2), deformed, ugly, deformed eyes, blur, out of focus, blurry, deformed cat, deformed, photo, anthropomorphic cat, monochrome, photo, pet collar, gun, weapon, blue, 3d, drones, drone, buildings in background, green"
14
  result = client.predict(
 
16
  condition_pose, # filepath in 'Upload a reference pose image (optional)' Image component
17
  prompt, # str in 'Prompt' Textbox component
18
  negative_prompt, # str in 'Negative Prompt' Textbox component
19
+ style, # Literal['(No style)', 'Watercolor', 'Film Noir', 'Neon', 'Jungle', 'Mars', 'Vibrant Color', 'Snow', 'Line art'] in 'Style template' Dropdown component
20
  True, # bool in 'Enhance non-face region' Checkbox component
21
  20, # float (numeric value between 20 and 100) in 'Number of sample steps' Slider component
22
  0.8, # float (numeric value between 0 and 1.5) in 'IdentityNet strength (for fedility)' Slider component
 
54
  print(result)
55
  return result[0]["video"]
56
 
57
+ def infer(image_in, camera_shot, conditional_pose, prompt, style, chosen_model):
58
  if camera_shot == "custom":
59
  if conditional_pose != None:
60
  conditional_pose = conditional_pose
 
74
  elif camera_shot == "full shot":
75
  conditional_pose = "camera_shots/full_shot.jpeg"
76
 
77
+ iid_img = get_instantID(image_in, conditional_pose, prompt, style)
78
 
79
  if chosen_model == "i2vgen-xl" :
80
  video_res = get_video_i2vgen(iid_img, prompt)
 
134
  camera_shot,
135
  condition_shot,
136
  prompt,
137
+ style,
138
  chosen_model
139
  ],
140
  outputs = [