fantos commited on
Commit
ed50e5b
Β·
verified Β·
1 Parent(s): 5c8677b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -45
app.py CHANGED
@@ -42,65 +42,43 @@ with gr.Blocks(theme=gr.themes.Default()) as demo:
42
  gr.HTML("""
43
  <h1 style="text-align: center; font-size: 2.2em; margin-bottom: 0.2em;">🎨 BadgeCraft - Beautiful Badge Generator</h1>
44
  <p style="text-align: center; font-size: 1.1em; color: #555;">Design stylish shields.io badges with live preview and HTML snippet generation.</p>
45
-
46
- <h3 style="text-align: center; margin-top: 30px;">✨ Examples</h3>
47
- <div align="center" style="display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin: 10px 0 30px; justify-items: center;">
48
- <a href="https://discord.gg/openfreeai">
49
- <img alt="Discord" src="https://img.shields.io/badge/Discord-5865F2?style=for-the-badge&logo=discord&logoColor=white" />
50
- </a>
51
- <a href="https://x.com/openfree_ai">
52
- <img alt="X" src="https://img.shields.io/badge/X.com-000000?style=for-the-badge&logo=X&logoColor=white" />
53
- </a>
54
- <a href="https://huggingface.co/collections/VIDraft/best-open-ai-services-68057e6e312880ea92abaf4c">
55
- <img alt="Collections" src="https://img.shields.io/badge/Collections-F8F8F8?style=for-the-badge&logo=huggingface&logoColor=black" />
56
- </a>
57
- <a href="https://huggingface.co/VIDraft">
58
- <img alt="VIDraft" src="https://img.shields.io/badge/VIDraft-FCD022?style=for-the-badge&logo=huggingface&logoColor=black" />
59
- </a>
60
- <a href="https://github.com/openfreeai">
61
- <img src="https://img.shields.io/badge/GitHub-181717?style=for-the-badge&logo=github&logoColor=white" alt="GitHub">
62
- </a>
63
- <a href="https://twitter.com/openfree_ai">
64
- <img src="https://img.shields.io/badge/Twitter-1DA1F2?style=for-the-badge&logo=twitter&logoColor=white" alt="Twitter">
65
- </a>
66
- <a href="https://www.linkedin.com/company/openfreeai">
67
- <img src="https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white" alt="LinkedIn">
68
- </a>
69
- <a href="https://www.youtube.com/@AITechTree">
70
- <img src="https://img.shields.io/badge/YouTube-FF0000?style=for-the-badge&logo=youtube&logoColor=white" alt="YouTube">
71
- </a>
72
- <a href="https://huggingface.co/openfreeai">
73
- <img src="https://img.shields.io/badge/HuggingFace-FCC72E?style=for-the-badge&logo=huggingface&logoColor=black" alt="HuggingFace">
74
- </a>
75
- <a href="https://www.instagram.com/openfree_ai">
76
- <img src="https://img.shields.io/badge/Instagram-E4405F?style=for-the-badge&logo=instagram&logoColor=white" alt="Instagram">
77
- </a>
78
- <a href="https://www.threads.net/@openfree_ai">
79
- <img src="https://img.shields.io/badge/Threads-000000?style=for-the-badge&logo=threads&logoColor=white" alt="Threads">
80
- </a>
81
- <a href="https://www.facebook.com/profile.php?id=61575353674679">
82
- <img src="https://img.shields.io/badge/Facebook-1877F2?style=for-the-badge&logo=facebook&logoColor=white" alt="Facebook">
83
- </a>
84
- </div>
85
  """)
86
 
87
- with gr.Row():
88
- out_code = gr.Code(label="HTML Snippet", language="html")
89
- out_preview = gr.HTML(label="Badge Preview")
90
 
 
91
  with gr.Row():
92
  label = gr.Textbox(label="Label", placeholder="예: build")
93
  message = gr.Textbox(label="Message", placeholder="예: passing")
94
  logo = gr.Textbox(label="Logo", placeholder="예: github")
95
-
96
  with gr.Row():
97
  color = gr.ColorPicker(label="Color", value="#a0c4ff")
98
  label_color = gr.ColorPicker(label="Label Color", value="#bdb2ff")
99
  logo_color = gr.ColorPicker(label="Logo Color", value="#ffc6ff")
100
-
101
  style = gr.Dropdown(label="Style", choices=["flat", "flat-square", "plastic", "for-the-badge", "social"], value="for-the-badge")
102
  link = gr.Textbox(label="Link (λ°°μ§€ 클릭 μ‹œ 이동할 URL)", placeholder="https://yourlink.com")
103
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
104
  inputs = [label, message, color, label_color, logo, logo_color, style, link]
105
  for inp in inputs:
106
  inp.change(fn=generate_static_badge, inputs=inputs, outputs=[out_code, out_preview])
 
42
  gr.HTML("""
43
  <h1 style="text-align: center; font-size: 2.2em; margin-bottom: 0.2em;">🎨 BadgeCraft - Beautiful Badge Generator</h1>
44
  <p style="text-align: center; font-size: 1.1em; color: #555;">Design stylish shields.io badges with live preview and HTML snippet generation.</p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  """)
46
 
47
+ # 좜λ ₯ μ»΄ν¬λ„ŒνŠΈ
48
+ out_code = gr.Code(label="HTML Snippet", language="html")
49
+ out_preview = gr.HTML(label="Badge Preview")
50
 
51
+ # μž…λ ₯ μ»΄ν¬λ„ŒνŠΈ
52
  with gr.Row():
53
  label = gr.Textbox(label="Label", placeholder="예: build")
54
  message = gr.Textbox(label="Message", placeholder="예: passing")
55
  logo = gr.Textbox(label="Logo", placeholder="예: github")
 
56
  with gr.Row():
57
  color = gr.ColorPicker(label="Color", value="#a0c4ff")
58
  label_color = gr.ColorPicker(label="Label Color", value="#bdb2ff")
59
  logo_color = gr.ColorPicker(label="Logo Color", value="#ffc6ff")
 
60
  style = gr.Dropdown(label="Style", choices=["flat", "flat-square", "plastic", "for-the-badge", "social"], value="for-the-badge")
61
  link = gr.Textbox(label="Link (λ°°μ§€ 클릭 μ‹œ 이동할 URL)", placeholder="https://yourlink.com")
62
 
63
+ # Examples μ •μ˜ (8개 ν•„λ“œ μˆœμ„œλŒ€λ‘œ)
64
+ examples = [
65
+ ["Discord", "5865F2", "", "", "discord", "white", "for-the-badge", "https://discord.gg/openfreeai"],
66
+ ["X.com", "000000", "", "", "X", "white", "for-the-badge", "https://x.com/openfree_ai"],
67
+ ["Collections", "", "", "", "huggingface", "black", "for-the-badge", "https://huggingface.co/collections/VIDraft/best-open-ai-services-68057e6e312880ea92abaf4c"],
68
+ ["GitHub", "", "", "", "github", "white", "for-the-badge", "https://github.com/openfreeai"],
69
+ ["YouTube", "", "#FF0000", "", "youtube", "white", "for-the-badge", "https://www.youtube.com/@AITechTree"],
70
+ ]
71
+ gr.HTML("<h3 style='text-align:center; margin-top:20px;'>✨ Examples (ν΄λ¦­ν•˜λ©΄ μžλ™ μž…λ ₯)</h3>")
72
+ gr.Examples(
73
+ examples=examples,
74
+ inputs=[label, message, color, label_color, logo, logo_color, style, link],
75
+ outputs=[out_code, out_preview],
76
+ fn=generate_static_badge,
77
+ cache_examples=False,
78
+ run_on_click=True,
79
+ )
80
+
81
+ # μ‹€μ‹œκ°„ change 이벀트 바인딩
82
  inputs = [label, message, color, label_color, logo, logo_color, style, link]
83
  for inp in inputs:
84
  inp.change(fn=generate_static_badge, inputs=inputs, outputs=[out_code, out_preview])