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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -17
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
- 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;}
86
  .card{height:480px;}
87
  }
88
  </style>"""
89
-
90
  js = """
91
  <script>
92
- /* (ํ—ˆ๊น…ํŽ˜์ด์Šค iframe ๋กœ๋”ฉ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ ์Šคํฌ๋ฆฝํŠธ โ€“ ๊ธฐ์กด๊ณผ ๋™์ผ) */
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()