Spaces:
Runtime error
Runtime error
Update gradio_app.py
Browse files- gradio_app.py +19 -8
gradio_app.py
CHANGED
|
@@ -106,11 +106,11 @@ def run_inference(user_prompt, guidance_scale, num_sampling_steps, seed, enable_
|
|
| 106 |
return result_path
|
| 107 |
|
| 108 |
css="""
|
| 109 |
-
#upl-dataset-group {background-color: none!important;}
|
| 110 |
div#warning-ready {
|
| 111 |
background-color: #ecfdf5;
|
| 112 |
padding: 0 16px 16px;
|
| 113 |
margin: 20px 0;
|
|
|
|
| 114 |
}
|
| 115 |
div#warning-ready > .gr-prose > h2, div#warning-ready > .gr-prose > p {
|
| 116 |
color: #057857!important;
|
|
@@ -119,6 +119,7 @@ div#warning-duplicate {
|
|
| 119 |
background-color: #ebf5ff;
|
| 120 |
padding: 0 16px 16px;
|
| 121 |
margin: 20px 0;
|
|
|
|
| 122 |
}
|
| 123 |
div#warning-duplicate > .gr-prose > h2, div#warning-duplicate > .gr-prose > p {
|
| 124 |
color: #0f4592!important;
|
|
@@ -139,6 +140,7 @@ div#warning-setgpu {
|
|
| 139 |
background-color: #fff4eb;
|
| 140 |
padding: 0 16px 16px;
|
| 141 |
margin: 20px 0;
|
|
|
|
| 142 |
}
|
| 143 |
div#warning-setgpu > .gr-prose > h2, div#warning-setgpu > .gr-prose > p {
|
| 144 |
color: #92220f!important;
|
|
@@ -156,6 +158,15 @@ div#warning-setgpu p.actions > a {
|
|
| 156 |
font-weight: 600;
|
| 157 |
font-size: 1.2em;
|
| 158 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 159 |
"""
|
| 160 |
|
| 161 |
# Create Gradio interface
|
|
@@ -175,13 +186,13 @@ with gr.Blocks(css=css) as demo:
|
|
| 175 |
if is_shared_ui:
|
| 176 |
top_description = gr.HTML(f'''
|
| 177 |
<div class="gr-prose">
|
| 178 |
-
<h2><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>
|
| 179 |
Attention: this Space need to be duplicated to work</h2>
|
| 180 |
-
<p class="main-message">
|
| 181 |
To make it work, <strong>duplicate the Space</strong> and run it on your own profile using a <strong>private</strong> GPU.<br />
|
| 182 |
You'll be able to offload the model into CPU for less GPU memory cost (about 9.3G, compared to 27.5G if CPU offload is not enabled), but the inference time will increase significantly.
|
| 183 |
</p>
|
| 184 |
-
<p class="actions">
|
| 185 |
<a href="https://huggingface.co/spaces/{os.environ['SPACE_ID']}?duplicate=true">
|
| 186 |
<img src="https://huggingface.co/datasets/huggingface/badges/resolve/main/duplicate-this-space-lg-dark.svg" alt="Duplicate this Space" />
|
| 187 |
</a>
|
|
@@ -194,9 +205,9 @@ with gr.Blocks(css=css) as demo:
|
|
| 194 |
submit_btn = gr.Button("Generate Video", visible=True)
|
| 195 |
top_description = gr.HTML(f'''
|
| 196 |
<div class="gr-prose">
|
| 197 |
-
<h2><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>
|
| 198 |
You have successfully associated a {gpu_info} GPU to this Space π</h2>
|
| 199 |
-
<p>
|
| 200 |
You can now generate a video! You will be billed by the minute from when you activated the GPU until when it is turned off.
|
| 201 |
</p>
|
| 202 |
</div>
|
|
@@ -204,11 +215,11 @@ with gr.Blocks(css=css) as demo:
|
|
| 204 |
else:
|
| 205 |
top_description = gr.HTML(f'''
|
| 206 |
<div class="gr-prose">
|
| 207 |
-
<h2><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>
|
| 208 |
You have successfully duplicated the Allegro Video Generation Space π</h2>
|
| 209 |
<p>There's only one step left before you can generate a video: we recommend to <a href="https://huggingface.co/spaces/{os.environ['SPACE_ID']}/settings" style="text-decoration: underline" target="_blank">attribute a L40S GPU</b> to it (via the Settings tab)</a>.
|
| 210 |
You will be billed by the minute from when you activate the GPU until when it is turned off.</p>
|
| 211 |
-
<p class="actions">
|
| 212 |
<a href="https://huggingface.co/spaces/{os.environ['SPACE_ID']}/settings">π₯ Set recommended GPU</a>
|
| 213 |
</p>
|
| 214 |
</div>
|
|
|
|
| 106 |
return result_path
|
| 107 |
|
| 108 |
css="""
|
|
|
|
| 109 |
div#warning-ready {
|
| 110 |
background-color: #ecfdf5;
|
| 111 |
padding: 0 16px 16px;
|
| 112 |
margin: 20px 0;
|
| 113 |
+
color: #030303!important;
|
| 114 |
}
|
| 115 |
div#warning-ready > .gr-prose > h2, div#warning-ready > .gr-prose > p {
|
| 116 |
color: #057857!important;
|
|
|
|
| 119 |
background-color: #ebf5ff;
|
| 120 |
padding: 0 16px 16px;
|
| 121 |
margin: 20px 0;
|
| 122 |
+
color: #030303!important;
|
| 123 |
}
|
| 124 |
div#warning-duplicate > .gr-prose > h2, div#warning-duplicate > .gr-prose > p {
|
| 125 |
color: #0f4592!important;
|
|
|
|
| 140 |
background-color: #fff4eb;
|
| 141 |
padding: 0 16px 16px;
|
| 142 |
margin: 20px 0;
|
| 143 |
+
color: #030303!important;
|
| 144 |
}
|
| 145 |
div#warning-setgpu > .gr-prose > h2, div#warning-setgpu > .gr-prose > p {
|
| 146 |
color: #92220f!important;
|
|
|
|
| 158 |
font-weight: 600;
|
| 159 |
font-size: 1.2em;
|
| 160 |
}
|
| 161 |
+
div#warning-setsleeptime {
|
| 162 |
+
background-color: #fff4eb;
|
| 163 |
+
padding: 10px 10px;
|
| 164 |
+
margin: 0!important;
|
| 165 |
+
color: #030303!important;
|
| 166 |
+
}
|
| 167 |
+
.custom-color {
|
| 168 |
+
color: #030303 !important;
|
| 169 |
+
}
|
| 170 |
"""
|
| 171 |
|
| 172 |
# Create Gradio interface
|
|
|
|
| 186 |
if is_shared_ui:
|
| 187 |
top_description = gr.HTML(f'''
|
| 188 |
<div class="gr-prose">
|
| 189 |
+
<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>
|
| 190 |
Attention: this Space need to be duplicated to work</h2>
|
| 191 |
+
<p class="main-message custom-color">
|
| 192 |
To make it work, <strong>duplicate the Space</strong> and run it on your own profile using a <strong>private</strong> GPU.<br />
|
| 193 |
You'll be able to offload the model into CPU for less GPU memory cost (about 9.3G, compared to 27.5G if CPU offload is not enabled), but the inference time will increase significantly.
|
| 194 |
</p>
|
| 195 |
+
<p class="actions custom-color">
|
| 196 |
<a href="https://huggingface.co/spaces/{os.environ['SPACE_ID']}?duplicate=true">
|
| 197 |
<img src="https://huggingface.co/datasets/huggingface/badges/resolve/main/duplicate-this-space-lg-dark.svg" alt="Duplicate this Space" />
|
| 198 |
</a>
|
|
|
|
| 205 |
submit_btn = gr.Button("Generate Video", visible=True)
|
| 206 |
top_description = gr.HTML(f'''
|
| 207 |
<div class="gr-prose">
|
| 208 |
+
<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>
|
| 209 |
You have successfully associated a {gpu_info} GPU to this Space π</h2>
|
| 210 |
+
<p class="custom-color">
|
| 211 |
You can now generate a video! You will be billed by the minute from when you activated the GPU until when it is turned off.
|
| 212 |
</p>
|
| 213 |
</div>
|
|
|
|
| 215 |
else:
|
| 216 |
top_description = gr.HTML(f'''
|
| 217 |
<div class="gr-prose">
|
| 218 |
+
<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>
|
| 219 |
You have successfully duplicated the Allegro Video Generation Space π</h2>
|
| 220 |
<p>There's only one step left before you can generate a video: we recommend to <a href="https://huggingface.co/spaces/{os.environ['SPACE_ID']}/settings" style="text-decoration: underline" target="_blank">attribute a L40S GPU</b> to it (via the Settings tab)</a>.
|
| 221 |
You will be billed by the minute from when you activate the GPU until when it is turned off.</p>
|
| 222 |
+
<p class="actions custom-color">
|
| 223 |
<a href="https://huggingface.co/spaces/{os.environ['SPACE_ID']}/settings">π₯ Set recommended GPU</a>
|
| 224 |
</p>
|
| 225 |
</div>
|