ziyangmai commited on
Commit
184537d
·
1 Parent(s): 1443134

modify req

Browse files
Files changed (2) hide show
  1. app.py +66 -2
  2. requirements.txt +2 -2
app.py CHANGED
@@ -99,6 +99,10 @@ def update_preview_video(checkpoint_dir):
99
  return gr.update(value=f'results/{parent_dir}/source.mp4')
100
 
101
 
 
 
 
 
102
  if __name__ == "__main__":
103
 
104
  if os.path.exists('results/custom'):
@@ -130,8 +134,67 @@ if __name__ == "__main__":
130
  ['results/train_ride/source.mp4','A motorbike driving in a forest','object','train_ride/checkpoint'],
131
  ]
132
 
 
133
  # 创建Gradio界面
134
- with gr.Blocks() as demo:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
135
  with gr.Tab("Train"):
136
  with gr.Row():
137
  with gr.Column():
@@ -169,6 +232,7 @@ if __name__ == "__main__":
169
  with gr.Column():
170
 
171
  output_video = gr.Video(label="Output Video")
 
172
 
173
  with gr.Accordion("Advanced Settings", open=False):
174
  with gr.Row():
@@ -184,6 +248,6 @@ if __name__ == "__main__":
184
  checkpoint_dropdown.change(fn=update_preview_video, inputs=checkpoint_dropdown, outputs=preview_video)
185
  checkpoint_output.change(update_checkpoints, inputs=checkpoint_output, outputs=checkpoint_dropdown)
186
  inference_button.click(inference_model, inputs=[text_input, checkpoint_dropdown,inference_steps,motion_type, seed], outputs=output_video)
187
-
188
  # 启动Gradio界面
189
  demo.launch()
 
99
  return gr.update(value=f'results/{parent_dir}/source.mp4')
100
 
101
 
102
+ def update_generated_prompt(text):
103
+ return gr.update(value=text)
104
+
105
+
106
  if __name__ == "__main__":
107
 
108
  if os.path.exists('results/custom'):
 
134
  ['results/train_ride/source.mp4','A motorbike driving in a forest','object','train_ride/checkpoint'],
135
  ]
136
 
137
+ gradio_theme = gr.themes.Default()
138
  # 创建Gradio界面
139
+ with gr.Blocks(
140
+ theme=gradio_theme,
141
+ title="Motion Inversion",
142
+ css="""
143
+ #download {
144
+ height: 118px;
145
+ }
146
+ .slider .inner {
147
+ width: 5px;
148
+ background: #FFF;
149
+ }
150
+ .viewport {
151
+ aspect-ratio: 4/3;
152
+ }
153
+ .tabs button.selected {
154
+ font-size: 20px !important;
155
+ color: crimson !important;
156
+ }
157
+ h1 {
158
+ text-align: center;
159
+ display: block;
160
+ }
161
+ h2 {
162
+ text-align: center;
163
+ display: block;
164
+ }
165
+ h3 {
166
+ text-align: center;
167
+ display: block;
168
+ }
169
+ .md_feedback li {
170
+ margin-bottom: 0px !important;
171
+ }
172
+ """,
173
+ head="""
174
+ <script async src="https://www.googletagmanager.com/gtag/js?id=G-1FWSVCGZTG"></script>
175
+ <script>
176
+ window.dataLayer = window.dataLayer || [];
177
+ function gtag() {dataLayer.push(arguments);}
178
+ gtag('js', new Date());
179
+ gtag('config', 'G-1FWSVCGZTG');
180
+ </script>
181
+ """,
182
+ ) as demo:
183
+ gr.Markdown(
184
+ """
185
+ # Motion Inversion for Video Customization
186
+ <p align="center">
187
+ <a title="Page" href="https://wileewang.github.io/MotionInversion/" target="_blank" rel="noopener noreferrer" style="display: inline-block;">
188
+ <img src="https://img.shields.io/badge/Project-Website-pink?logo=googlechrome&logoColor=white">
189
+ </a>
190
+ <a title="arXiv" href="https://arxiv.org/abs/2403.20193" target="_blank" rel="noopener noreferrer" style="display: inline-block;">
191
+ <img src="https://img.shields.io/badge/arXiv-Paper-b31b1b?logo=arxiv&logoColor=white">
192
+ </a>
193
+ <a title="Github" href="https://github.com/EnVision-Research/MotionInversion" target="_blank" rel="noopener noreferrer" style="display: inline-block;">
194
+ <img src="https://img.shields.io/github/stars/EnVision-Research/MotionInversion?label=GitHub%20%E2%98%85&logo=github&color=C8C" alt="badge-github-stars">
195
+ </a>
196
+ """
197
+ )
198
  with gr.Tab("Train"):
199
  with gr.Row():
200
  with gr.Column():
 
232
  with gr.Column():
233
 
234
  output_video = gr.Video(label="Output Video")
235
+ generated_prompt = gr.Textbox(label="Generated Prompt")
236
 
237
  with gr.Accordion("Advanced Settings", open=False):
238
  with gr.Row():
 
248
  checkpoint_dropdown.change(fn=update_preview_video, inputs=checkpoint_dropdown, outputs=preview_video)
249
  checkpoint_output.change(update_checkpoints, inputs=checkpoint_output, outputs=checkpoint_dropdown)
250
  inference_button.click(inference_model, inputs=[text_input, checkpoint_dropdown,inference_steps,motion_type, seed], outputs=output_video)
251
+ output_video.change(fn=update_generated_prompt, inputs=[text_input], outputs=generated_prompt)
252
  # 启动Gradio界面
253
  demo.launch()
requirements.txt CHANGED
@@ -43,8 +43,8 @@ requests==2.32.3
43
  safetensors==0.4.5
44
  sympy==1.13.3
45
  tokenizers==0.20.1
46
- torch==2.4.1
47
- torchvision==0.19.1
48
  tqdm==4.66.5
49
  transformers==4.45.2
50
  triton==3.0.0
 
43
  safetensors==0.4.5
44
  sympy==1.13.3
45
  tokenizers==0.20.1
46
+ # torch==2.4.1
47
+ # torchvision==0.19.1
48
  tqdm==4.66.5
49
  transformers==4.45.2
50
  triton==3.0.0