Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
import spaces
|
2 |
import time
|
3 |
import os
|
4 |
-
import tempfile
|
5 |
|
6 |
# ONNX Runtime CUDA provider μλ (ν¨κ³Ό μλλΌλ 무ν΄)
|
7 |
os.environ.setdefault("INSIGHTFACE_ONNX_PROVIDERS", "CUDAExecutionProvider,CPUExecutionProvider")
|
@@ -206,22 +205,37 @@ def generate_image(
|
|
206 |
|
207 |
|
208 |
def create_demo(args, model_name: str, device: str = "cuda" if torch.cuda.is_available() else "cpu", offload: bool = False):
|
|
|
209 |
custom_css = """
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
214 |
/* μλ¨ λ°°μ§ μμμ΄ λ€λ₯Έ μμ λ€λ‘ κΉλ¦¬μ§ μλλ‘ */
|
215 |
-
#top-badges { position: relative; z-index:
|
216 |
-
|
217 |
-
|
218 |
-
|
|
|
|
|
219 |
}
|
220 |
"""
|
221 |
|
222 |
with gr.Blocks(theme="soft", css=custom_css) as demo:
|
223 |
-
# μ΅μλ¨ μ¬λ°± νλ³΄μ© μ€νμ΄μ (
|
224 |
-
gr.HTML("<div style='height:
|
225 |
gr.HTML(
|
226 |
"""
|
227 |
<div id="top-badges" class='container' style='display:flex; justify-content:center; gap:12px; margin-top:0;'>
|
@@ -351,6 +365,4 @@ if __name__ == "__main__":
|
|
351 |
huggingface_hub.login(hf_token)
|
352 |
|
353 |
demo = create_demo(args, args.name, args.device, args.offload)
|
354 |
-
# SSR λΉνμ±ν: λ λ μμ ν
|
355 |
demo.launch(ssr_mode=False)
|
356 |
-
|
|
|
1 |
import spaces
|
2 |
import time
|
3 |
import os
|
|
|
4 |
|
5 |
# ONNX Runtime CUDA provider μλ (ν¨κ³Ό μλλΌλ 무ν΄)
|
6 |
os.environ.setdefault("INSIGHTFACE_ONNX_PROVIDERS", "CUDAExecutionProvider,CPUExecutionProvider")
|
|
|
205 |
|
206 |
|
207 |
def create_demo(args, model_name: str, device: str = "cuda" if torch.cuda.is_available() else "cpu", offload: bool = False):
|
208 |
+
# νλ©΄ μλ¨μ΄ κ°λ €μ§λ λ¬Έμ λ₯Ό κ°νκ² μννλ μ μ CSS
|
209 |
custom_css = """
|
210 |
+
:root{
|
211 |
+
/* κΈ°λ³Έ HF μλ¨ ν΄λ° λμ΄ μΆμ μΉ (νκ²½μ λ°λΌ 56~84px) */
|
212 |
+
--hf-header-offset: 72px;
|
213 |
+
--safe-top: env(safe-area-inset-top, 0px);
|
214 |
+
--top-offset: calc(var(--hf-header-offset) + var(--safe-top));
|
215 |
+
}
|
216 |
+
html, body, #root, .gradio-container{
|
217 |
+
margin: 0 !important;
|
218 |
+
padding-top: var(--top-offset) !important; /* κ³ μ ν€λμ κ°λ¦¬μ§ μλλ‘ μλ¨ μ¬λ°± */
|
219 |
+
overflow: visible !important;
|
220 |
+
position: relative; /* μμ λ§₯λ½ λ³΄μ₯ */
|
221 |
+
z-index: 0;
|
222 |
+
}
|
223 |
+
/* λ΄λΆ μ΅μ»€/μλ μ€ν¬λ‘€ μμλ ν€λμ κ°λ €μ§μ§ μλλ‘ */
|
224 |
+
:root { scroll-margin-top: var(--top-offset); scroll-padding-top: var(--top-offset); }
|
225 |
+
|
226 |
/* μλ¨ λ°°μ§ μμμ΄ λ€λ₯Έ μμ λ€λ‘ κΉλ¦¬μ§ μλλ‘ */
|
227 |
+
#top-badges { position: relative; z-index: 2; margin-top: 0 !important; }
|
228 |
+
|
229 |
+
/* λͺ¨λ°μΌμμ ν€λκ° λ λκ² μ‘νλ κ²½μ° μ¬μ λ₯Ό λ μ€λ€ */
|
230 |
+
@media (max-width: 768px){
|
231 |
+
:root{ --hf-header-offset: 82px; }
|
232 |
+
.gradio-container { padding-top: calc(var(--top-offset) + 6px) !important; }
|
233 |
}
|
234 |
"""
|
235 |
|
236 |
with gr.Blocks(theme="soft", css=custom_css) as demo:
|
237 |
+
# μ΅μλ¨ μ¬λ°± νλ³΄μ© μ€νμ΄μ (λΈλΌμ°μ /κΈ°κΈ°λ³ μλ¨ κ³ μ λ° λμ)
|
238 |
+
gr.HTML("<div id='top-spacer' style='height: 0;'></div>")
|
239 |
gr.HTML(
|
240 |
"""
|
241 |
<div id="top-badges" class='container' style='display:flex; justify-content:center; gap:12px; margin-top:0;'>
|
|
|
365 |
huggingface_hub.login(hf_token)
|
366 |
|
367 |
demo = create_demo(args, args.name, args.device, args.offload)
|
|
|
368 |
demo.launch(ssr_mode=False)
|
|