Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
import gradio as gr
|
2 |
import os
|
3 |
import shutil
|
@@ -14,14 +15,6 @@ is_shared_ui = True if "fffiloni/MimicMotion" in os.environ['SPACE_ID'] else Fal
|
|
14 |
available_property = False if is_shared_ui else True
|
15 |
|
16 |
is_gpu_associated = torch.cuda.is_available()
|
17 |
-
if is_gpu_associated:
|
18 |
-
gpu_info = getoutput('nvidia-smi')
|
19 |
-
if("A10G" in gpu_info):
|
20 |
-
which_gpu = "A10G"
|
21 |
-
elif("T4" in gpu_info):
|
22 |
-
which_gpu = "T4"
|
23 |
-
else:
|
24 |
-
which_gpu = "CPU"
|
25 |
|
26 |
def stream_output(pipe):
|
27 |
for line in iter(pipe.readline, ''):
|
@@ -108,7 +101,8 @@ def get_video_fps(video_path):
|
|
108 |
|
109 |
def load_examples(ref_image_in, ref_video_in):
|
110 |
return "./examples/mimicmotion_result1_example.mp4"
|
111 |
-
|
|
|
112 |
def infer(ref_image_in, ref_video_in, num_inference_steps, guidance_scale, output_frames_per_second, seed, checkpoint_version):
|
113 |
# check if 'outputs' dir exists and empty it if necessary
|
114 |
check_outputs_folder('./outputs')
|
@@ -286,7 +280,7 @@ with gr.Blocks(css=css) as demo:
|
|
286 |
top_description = gr.HTML(f'''
|
287 |
<div class="gr-prose">
|
288 |
<h2 class="custom-color"><svg xmlns="http://www.w3.org/2000/svg" width="18px" height="18px" style="margin-right: 0px;display: inline-block;"fill="none"><path fill="#fff" d="M7 13.2a6.3 6.3 0 0 0 4.4-10.7A6.3 6.3 0 0 0 .6 6.9 6.3 6.3 0 0 0 7 13.2Z"/><path fill="#fff" fill-rule="evenodd" d="M7 0a6.9 6.9 0 0 1 4.8 11.8A6.9 6.9 0 0 1 0 7 6.9 6.9 0 0 1 7 0Zm0 0v.7V0ZM0 7h.6H0Zm7 6.8v-.6.6ZM13.7 7h-.6.6ZM9.1 1.7c-.7-.3-1.4-.4-2.2-.4a5.6 5.6 0 0 0-4 1.6 5.6 5.6 0 0 0-1.6 4 5.6 5.6 0 0 0 1.6 4 5.6 5.6 0 0 0 4 1.7 5.6 5.6 0 0 0 4-1.7 5.6 5.6 0 0 0 1.7-4 5.6 5.6 0 0 0-1.7-4c-.5-.5-1.1-.9-1.8-1.2Z" clip-rule="evenodd"/><path fill="#000" fill-rule="evenodd" d="M7 2.9a.8.8 0 1 1 0 1.5A.8.8 0 0 1 7 3ZM5.8 5.7c0-.4.3-.6.6-.6h.7c.3 0 .6.2.6.6v3.7h.5a.6.6 0 0 1 0 1.3H6a.6.6 0 0 1 0-1.3h.4v-3a.6.6 0 0 1-.6-.7Z" clip-rule="evenodd"/></svg>
|
289 |
-
You have successfully associated a
|
290 |
<p class="custom-color">
|
291 |
You will be billed by the minute from when you activated the GPU until when it is turned off.
|
292 |
</p>
|
|
|
1 |
+
import spaces
|
2 |
import gradio as gr
|
3 |
import os
|
4 |
import shutil
|
|
|
15 |
available_property = False if is_shared_ui else True
|
16 |
|
17 |
is_gpu_associated = torch.cuda.is_available()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
def stream_output(pipe):
|
20 |
for line in iter(pipe.readline, ''):
|
|
|
101 |
|
102 |
def load_examples(ref_image_in, ref_video_in):
|
103 |
return "./examples/mimicmotion_result1_example.mp4"
|
104 |
+
|
105 |
+
@spaces.GPU(duration=400)
|
106 |
def infer(ref_image_in, ref_video_in, num_inference_steps, guidance_scale, output_frames_per_second, seed, checkpoint_version):
|
107 |
# check if 'outputs' dir exists and empty it if necessary
|
108 |
check_outputs_folder('./outputs')
|
|
|
280 |
top_description = gr.HTML(f'''
|
281 |
<div class="gr-prose">
|
282 |
<h2 class="custom-color"><svg xmlns="http://www.w3.org/2000/svg" width="18px" height="18px" style="margin-right: 0px;display: inline-block;"fill="none"><path fill="#fff" d="M7 13.2a6.3 6.3 0 0 0 4.4-10.7A6.3 6.3 0 0 0 .6 6.9 6.3 6.3 0 0 0 7 13.2Z"/><path fill="#fff" fill-rule="evenodd" d="M7 0a6.9 6.9 0 0 1 4.8 11.8A6.9 6.9 0 0 1 0 7 6.9 6.9 0 0 1 7 0Zm0 0v.7V0ZM0 7h.6H0Zm7 6.8v-.6.6ZM13.7 7h-.6.6ZM9.1 1.7c-.7-.3-1.4-.4-2.2-.4a5.6 5.6 0 0 0-4 1.6 5.6 5.6 0 0 0-1.6 4 5.6 5.6 0 0 0 1.6 4 5.6 5.6 0 0 0 4 1.7 5.6 5.6 0 0 0 4-1.7 5.6 5.6 0 0 0 1.7-4 5.6 5.6 0 0 0-1.7-4c-.5-.5-1.1-.9-1.8-1.2Z" clip-rule="evenodd"/><path fill="#000" fill-rule="evenodd" d="M7 2.9a.8.8 0 1 1 0 1.5A.8.8 0 0 1 7 3ZM5.8 5.7c0-.4.3-.6.6-.6h.7c.3 0 .6.2.6.6v3.7h.5a.6.6 0 0 1 0 1.3H6a.6.6 0 0 1 0-1.3h.4v-3a.6.6 0 0 1-.6-.7Z" clip-rule="evenodd"/></svg>
|
283 |
+
You have successfully associated a ZERO GPU to this Space 🎉</h2>
|
284 |
<p class="custom-color">
|
285 |
You will be billed by the minute from when you activated the GPU until when it is turned off.
|
286 |
</p>
|