fffiloni commited on
Commit
bbae957
1 Parent(s): f8022d8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -8
app.py CHANGED
@@ -54,14 +54,8 @@ 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, style, chosen_model):
58
- if camera_shot == "custom":
59
- if conditional_pose != None:
60
- conditional_pose = conditional_pose
61
- else :
62
- raise gr.Error("No custom conditional shot found !")
63
-
64
- elif camera_shot == "close-up":
65
  conditional_pose = "camera_shots/close_up_shot.jpeg"
66
  elif camera_shot == "medium close-up":
67
  conditional_pose = "camera_shots/medium_close_up.jpeg"
@@ -73,6 +67,19 @@ def infer(image_in, camera_shot, conditional_pose, prompt, style, chosen_model):
73
  conditional_pose = "camera_shots/medium_full_shot.png"
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
 
@@ -127,6 +134,19 @@ with gr.Blocks(css=css) as demo:
127
  submit_btn = gr.Button("Submit")
128
  video_out = gr.Video()
129
 
 
 
 
 
 
 
 
 
 
 
 
 
 
130
  submit_btn.click(
131
  fn = infer,
132
  inputs = [
 
54
  print(result)
55
  return result[0]["video"]
56
 
57
+ def load_sample_shot(camera_shot):
58
+ if camera_shot == "close-up":
 
 
 
 
 
 
59
  conditional_pose = "camera_shots/close_up_shot.jpeg"
60
  elif camera_shot == "medium close-up":
61
  conditional_pose = "camera_shots/medium_close_up.jpeg"
 
67
  conditional_pose = "camera_shots/medium_full_shot.png"
68
  elif camera_shot == "full shot":
69
  conditional_pose = "camera_shots/full_shot.jpeg"
70
+ return conditional_pose
71
+
72
+ def use_custom_cond():
73
+ return "custom"
74
+
75
+ def infer(image_in, camera_shot, conditional_pose, prompt, style, chosen_model):
76
+
77
+ if camera_shot == "custom":
78
+ if conditional_pose != None:
79
+ conditional_pose = conditional_pose
80
+ else :
81
+ raise gr.Error("No custom conditional shot found !")
82
+
83
 
84
  iid_img = get_instantID(image_in, conditional_pose, prompt, style)
85
 
 
134
  submit_btn = gr.Button("Submit")
135
  video_out = gr.Video()
136
 
137
+
138
+ camera_shot.change(
139
+ fn = load_sample_shot,
140
+ inputs = camera_shot,
141
+ outputs = condition_shot,
142
+ queue=False
143
+ )
144
+ condition_shot.upload(
145
+ fn = use_custom_cond,
146
+ inputs = None,
147
+ outputs = camera_shot,
148
+ queue=False,
149
+ )
150
  submit_btn.click(
151
  fn = infer,
152
  inputs = [