openfree commited on
Commit
25e6244
ยท
verified ยท
1 Parent(s): 1ffb587

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -23
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
- margin:0;padding:0;font-family:Poppins,sans-serif;
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
- box-shadow:0 4px 10px rgba(0,0,0,0.08);
67
- height:420px; /* โ† ์นด๋“œ ํ‚ค์›€ */
68
- position:relative;
69
  }
70
- .frame{width:100%;height:100%;position:relative;overflow:hidden;}
71
  .frame iframe{
72
- position:absolute;top:0;left:0;
73
- width:166.667%;height:166.667%; /* 1/0.6 = 1.6667 */
74
- transform:scale(0.6); /* ๊ฒŒ์ž„ ํ™”๋ฉด 60โ€ฏ% ์ถ•์†Œ */
75
- transform-origin:top left;
76
- border:0;
 
 
 
 
77
  }
78
- /* ํ—ˆ๊น…ํŽ˜์ด์Šค ์ž„๋ฒ ๋“œ(์ด๋ฏธ ๋‚ด๋ถ€์„œ ์Šค์ผ€์ผ๋ง๋จ)๋Š” ๊ทธ๋Œ€๋กœ */
79
- .frame.huggingface iframe{
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()