Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -74,6 +74,16 @@ def load_sample_shot(camera_shot):
|
|
74 |
def use_custom_cond():
|
75 |
return "custom"
|
76 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
def infer(image_in, camera_shot, conditional_pose, prompt, style, chosen_model):
|
78 |
|
79 |
if camera_shot == "custom":
|
@@ -84,9 +94,11 @@ def infer(image_in, camera_shot, conditional_pose, prompt, style, chosen_model):
|
|
84 |
|
85 |
|
86 |
iid_img = get_instantID(image_in, conditional_pose, prompt, style)
|
|
|
|
|
87 |
|
88 |
if chosen_model == "i2vgen-xl" :
|
89 |
-
video_res = get_video_i2vgen(iid_img,
|
90 |
elif chosen_model == "stable-video" :
|
91 |
video_res = get_video_svd(image_in)
|
92 |
|
@@ -128,8 +140,8 @@ with gr.Blocks(css=css) as demo:
|
|
128 |
)
|
129 |
style = gr.Dropdown(label="Style template", info="InstantID legacy templates", choices=STYLE_NAMES, value=DEFAULT_STYLE_NAME)
|
130 |
|
131 |
-
condition_shot = gr.Image(type="filepath", label="Custom conditional shot (
|
132 |
-
prompt = gr.Textbox(label="Short Prompt (keeping it short is better")
|
133 |
chosen_model = gr.Radio(label="Choose a model", choices=["i2vgen-xl", "stable-video"], value="i2vgen-xl", interactive=False, visible=False)
|
134 |
|
135 |
with gr.Column():
|
|
|
74 |
def use_custom_cond():
|
75 |
return "custom"
|
76 |
|
77 |
+
def get_short_caption(image_in):
|
78 |
+
client = Client("https://vikhyatk-moondream1.hf.space/")
|
79 |
+
result = client.predict(
|
80 |
+
image_in, # filepath in 'image' Image component
|
81 |
+
"Describe what is happening in one sentence", # str in 'Question' Textbox component
|
82 |
+
api_name="/answer_question"
|
83 |
+
)
|
84 |
+
print(result)
|
85 |
+
return result
|
86 |
+
|
87 |
def infer(image_in, camera_shot, conditional_pose, prompt, style, chosen_model):
|
88 |
|
89 |
if camera_shot == "custom":
|
|
|
94 |
|
95 |
|
96 |
iid_img = get_instantID(image_in, conditional_pose, prompt, style)
|
97 |
+
|
98 |
+
short_cap = get_short_caption(iid_img)
|
99 |
|
100 |
if chosen_model == "i2vgen-xl" :
|
101 |
+
video_res = get_video_i2vgen(iid_img, short_cap)
|
102 |
elif chosen_model == "stable-video" :
|
103 |
video_res = get_video_svd(image_in)
|
104 |
|
|
|
140 |
)
|
141 |
style = gr.Dropdown(label="Style template", info="InstantID legacy templates", choices=STYLE_NAMES, value=DEFAULT_STYLE_NAME)
|
142 |
|
143 |
+
condition_shot = gr.Image(type="filepath", label="Custom conditional shot (Important) [1280*720 recommended]")
|
144 |
+
prompt = gr.Textbox(label="Short Prompt (keeping it short is better)")
|
145 |
chosen_model = gr.Radio(label="Choose a model", choices=["i2vgen-xl", "stable-video"], value="i2vgen-xl", interactive=False, visible=False)
|
146 |
|
147 |
with gr.Column():
|