Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -47,52 +47,56 @@ def process_url_for_iframe(url):
|
|
47 |
return f"https://huggingface.co/spaces/{owner}/{name}/embed", True, []
|
48 |
return url, False, []
|
49 |
|
50 |
-
# โโโโโโโโโโโโโโโโโโโโโ 4. ์นด๋ ๊ทธ๋ฆฌ๋ HTML โโโโโโโโโโโโโโโ
|
51 |
-
# โโโโโโโโโโโโโโโโโโโโโ 6. HTML ๊ทธ๋ฆฌ๋ โโโโโโโโโโโโโโโโโโโ
|
52 |
# โโโโโโโโโโโโโโโโโโโโโ 6. HTML ๊ทธ๋ฆฌ๋ โโโโโโโโโโโโโโโโโโโ
|
53 |
def html(cards, pg, total):
|
54 |
if not cards:
|
55 |
return "<div style='text-align:center;padding:70px;color:#555;'>ํ์ํ ๋ฐฐํฌ๊ฐ ์์ต๋๋ค.</div>"
|
|
|
56 |
css = r"""
|
57 |
<style>
|
58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
.container{width:100%;padding:10px 10px 70px;box-sizing:border-box;}
|
60 |
.grid{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;width:100%;}
|
61 |
.card{
|
62 |
background:#fff;border-radius:10px;overflow:hidden;box-shadow:0 4px 10px rgba(0,0,0,0.08);
|
63 |
height:420px;display:flex;flex-direction:column;position:relative;
|
64 |
}
|
|
|
|
|
65 |
.frame{flex:1;position:relative;overflow:hidden;}
|
66 |
.frame iframe{
|
67 |
-
position:absolute;top:0;left:0;
|
|
|
68 |
transform:scale(0.6);transform-origin:top left;border:0;
|
69 |
}
|
70 |
.frame.huggingface iframe{width:100%!important;height:100%!important;transform:none!important;border:none!important;}
|
71 |
|
72 |
-
/* ํ๋จ ๋ฐ๋ก๊ฐ๊ธฐ
|
73 |
-
.foot{
|
74 |
-
|
75 |
-
background:#fafafa;border-top:1px solid #eee;
|
76 |
-
}
|
77 |
-
.foot a{
|
78 |
-
font-size:0.85rem;font-weight:600;color:#4a6dd8;text-decoration:none;
|
79 |
-
}
|
80 |
.foot a:hover{text-decoration:underline;}
|
81 |
|
82 |
-
/* ๋ฐ์ํ
|
83 |
@media(min-width:1200px){.card{height:560px;}}
|
84 |
@media(max-width:767px){
|
85 |
.grid{grid-template-columns:1fr;}
|
86 |
.card{height:480px;}
|
87 |
}
|
88 |
</style>"""
|
89 |
-
|
90 |
js = """
|
91 |
<script>
|
92 |
-
/*
|
93 |
</script>
|
94 |
"""
|
95 |
-
|
96 |
h = css + js + '<div class="container"><div class="grid">'
|
97 |
for idx, url in enumerate(cards):
|
98 |
iframe_url, is_huggingface, alt_urls = process_url_for_iframe(url)
|
@@ -113,7 +117,6 @@ def html(cards, pg, total):
|
|
113 |
return h
|
114 |
|
115 |
|
116 |
-
|
117 |
# โโโโโโโโโโโโโโโโโโโโโ 5. Gradio UI โโโโโโโโโโโโโโโโโโโโโ
|
118 |
def build():
|
119 |
_init_best()
|
|
|
47 |
return f"https://huggingface.co/spaces/{owner}/{name}/embed", True, []
|
48 |
return url, False, []
|
49 |
|
|
|
|
|
50 |
# โโโโโโโโโโโโโโโโโโโโโ 6. HTML ๊ทธ๋ฆฌ๋ โโโโโโโโโโโโโโโโโโโ
|
51 |
def html(cards, pg, total):
|
52 |
if not cards:
|
53 |
return "<div style='text-align:center;padding:70px;color:#555;'>ํ์ํ ๋ฐฐํฌ๊ฐ ์์ต๋๋ค.</div>"
|
54 |
+
|
55 |
css = r"""
|
56 |
<style>
|
57 |
+
/* ํ์คํ
๊ทธ๋ผ๋์์ด์
๋ฐฐ๊ฒฝ */
|
58 |
+
body{
|
59 |
+
margin:0;padding:0;font-family:Poppins,sans-serif;
|
60 |
+
background:linear-gradient(135deg,#fdf4ff 0%,#f6fbff 50%,#fffaf4 100%);
|
61 |
+
background-attachment:fixed;
|
62 |
+
overflow-x:hidden;overflow-y:auto;
|
63 |
+
}
|
64 |
+
|
65 |
.container{width:100%;padding:10px 10px 70px;box-sizing:border-box;}
|
66 |
.grid{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;width:100%;}
|
67 |
.card{
|
68 |
background:#fff;border-radius:10px;overflow:hidden;box-shadow:0 4px 10px rgba(0,0,0,0.08);
|
69 |
height:420px;display:flex;flex-direction:column;position:relative;
|
70 |
}
|
71 |
+
|
72 |
+
/* ๊ฒ์ ํ๋ฉด ์ถ์ */
|
73 |
.frame{flex:1;position:relative;overflow:hidden;}
|
74 |
.frame iframe{
|
75 |
+
position:absolute;top:0;left:0;
|
76 |
+
width:166.667%;height:166.667%;
|
77 |
transform:scale(0.6);transform-origin:top left;border:0;
|
78 |
}
|
79 |
.frame.huggingface iframe{width:100%!important;height:100%!important;transform:none!important;border:none!important;}
|
80 |
|
81 |
+
/* ํ๋จ ๋ฐ๋ก๊ฐ๊ธฐ */
|
82 |
+
.foot{height:34px;display:flex;align-items:center;justify-content:center;background:#fafafa;border-top:1px solid #eee;}
|
83 |
+
.foot a{font-size:0.85rem;font-weight:600;color:#4a6dd8;text-decoration:none;}
|
|
|
|
|
|
|
|
|
|
|
84 |
.foot a:hover{text-decoration:underline;}
|
85 |
|
86 |
+
/* ๋ฐ์ํ ๋์ด */
|
87 |
@media(min-width:1200px){.card{height:560px;}}
|
88 |
@media(max-width:767px){
|
89 |
.grid{grid-template-columns:1fr;}
|
90 |
.card{height:480px;}
|
91 |
}
|
92 |
</style>"""
|
93 |
+
|
94 |
js = """
|
95 |
<script>
|
96 |
+
/* ํ๊น
ํ์ด์ค iframe ๋ก๋ฉ ์ค๋ฅ ์ฒ๋ฆฌ(์๋ต - ๊ธฐ์กด ์คํฌ๋ฆฝํธ ๊ทธ๋๋ก) */
|
97 |
</script>
|
98 |
"""
|
99 |
+
|
100 |
h = css + js + '<div class="container"><div class="grid">'
|
101 |
for idx, url in enumerate(cards):
|
102 |
iframe_url, is_huggingface, alt_urls = process_url_for_iframe(url)
|
|
|
117 |
return h
|
118 |
|
119 |
|
|
|
120 |
# โโโโโโโโโโโโโโโโโโโโโ 5. Gradio UI โโโโโโโโโโโโโโโโโโโโโ
|
121 |
def build():
|
122 |
_init_best()
|