Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -49,38 +49,37 @@ def process_url_for_iframe(url):
|
|
49 |
|
50 |
# โโโโโโโโโโโโโโโโโโโโโ 4. ์นด๋ ๊ทธ๋ฆฌ๋ HTML โโโโโโโโโโโโโโโ
|
51 |
# โโโโโโโโโโโโโโโโโโโโโ 6. HTML ๊ทธ๋ฆฌ๋ โโโโโโโโโโโโโโโโโโโ
|
|
|
52 |
def html(cards, pg, total):
|
53 |
if not cards:
|
54 |
return "<div style='text-align:center;padding:70px;color:#555;'>ํ์ํ ๋ฐฐํฌ๊ฐ ์์ต๋๋ค.</div>"
|
55 |
css = r"""
|
56 |
<style>
|
57 |
-
body{
|
58 |
-
|
59 |
-
background:#f0f0f0;overflow-x:hidden;overflow-y:auto;
|
60 |
-
}
|
61 |
-
.container{width:100%;padding:10px;padding-bottom:70px;box-sizing:border-box;}
|
62 |
.grid{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;width:100%;}
|
63 |
-
/* ์นด๋ ์ ์ฒด๊ฐ ๊ฒ์ ํ๋ฉด โ ํ
๋๋ฆฌ๋ง ๋ ์ํ */
|
64 |
.card{
|
65 |
-
background:#fff;border-radius:10px;overflow:hidden;
|
66 |
-
|
67 |
-
height:420px; /* โ ์นด๋ ํค์ */
|
68 |
-
position:relative;
|
69 |
}
|
70 |
-
.frame{
|
71 |
.frame iframe{
|
72 |
-
position:absolute;top:0;left:0;
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
|
|
|
|
|
|
|
|
77 |
}
|
78 |
-
|
79 |
-
|
80 |
-
width:100%!important;height:100%!important;
|
81 |
-
transform:none!important;border:none!important;
|
82 |
}
|
83 |
-
|
|
|
|
|
84 |
@media(min-width:1200px){.card{height:560px;}}
|
85 |
@media(max-width:767px){
|
86 |
.grid{grid-template-columns:1fr;}
|
@@ -88,10 +87,9 @@ def html(cards, pg, total):
|
|
88 |
}
|
89 |
</style>"""
|
90 |
|
91 |
-
# โฌ(์ดํ JS ๋ฐ ์นด๋ ์์ฑ ๋ก์ง์ ๊ธฐ์กด๊ณผ ๋์ผ)โฌ
|
92 |
js = """
|
93 |
<script>
|
94 |
-
/*
|
95 |
</script>
|
96 |
"""
|
97 |
|
@@ -108,12 +106,14 @@ def html(cards, pg, total):
|
|
108 |
sandbox="allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-downloads"
|
109 |
data-original-url="{url}" {alt_attr}></iframe>
|
110 |
</div>
|
|
|
111 |
</div>"""
|
112 |
h += "</div></div>"
|
113 |
h += f'<div class="page-info">Page {pg} / {total}</div>'
|
114 |
return h
|
115 |
|
116 |
|
|
|
117 |
# โโโโโโโโโโโโโโโโโโโโโ 5. Gradio UI โโโโโโโโโโโโโโโโโโโโโ
|
118 |
def build():
|
119 |
_init_best()
|
|
|
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 |
+
body{margin:0;padding:0;font-family:Poppins,sans-serif;background:#f0f0f0;overflow-x:hidden;overflow-y:auto;}
|
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;width:166.667%;height:166.667%;
|
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 |
+
height:34px;flex-shrink:0;display:flex;align-items:center;justify-content:center;
|
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;}
|
|
|
87 |
}
|
88 |
</style>"""
|
89 |
|
|
|
90 |
js = """
|
91 |
<script>
|
92 |
+
/* (ํ๊น
ํ์ด์ค iframe ๋ก๋ฉ ์ค๋ฅ ์ฒ๋ฆฌ ์คํฌ๋ฆฝํธ โ ๊ธฐ์กด๊ณผ ๋์ผ) */
|
93 |
</script>
|
94 |
"""
|
95 |
|
|
|
106 |
sandbox="allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-downloads"
|
107 |
data-original-url="{url}" {alt_attr}></iframe>
|
108 |
</div>
|
109 |
+
<div class="foot"><a href="{url}" target="_blank">โ ์ ํญ์ผ๋ก ์ด๊ธฐ</a></div>
|
110 |
</div>"""
|
111 |
h += "</div></div>"
|
112 |
h += f'<div class="page-info">Page {pg} / {total}</div>'
|
113 |
return h
|
114 |
|
115 |
|
116 |
+
|
117 |
# โโโโโโโโโโโโโโโโโโโโโ 5. Gradio UI โโโโโโโโโโโโโโโโโโโโโ
|
118 |
def build():
|
119 |
_init_best()
|