Update app-backup2.py
Browse files- app-backup2.py +28 -3
app-backup2.py
CHANGED
|
@@ -39,10 +39,10 @@ def generate_static_badge(label, message, color, label_color, logo, logo_color,
|
|
| 39 |
# Gradio UI ๊ตฌ์ฑ
|
| 40 |
# ---------------------------
|
| 41 |
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">
|
|
@@ -84,23 +84,48 @@ with gr.Blocks(theme=gr.themes.Default()) as demo:
|
|
| 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])
|
|
|
|
| 39 |
# Gradio UI ๊ตฌ์ฑ
|
| 40 |
# ---------------------------
|
| 41 |
with gr.Blocks(theme=gr.themes.Default()) as demo:
|
| 42 |
+
# ๊ธฐ์กด static ์์ ์์ด์ฝ๋ค
|
| 43 |
gr.HTML("""
|
| 44 |
<h1 style="text-align: center; font-size: 2.2em; margin-bottom: 0.2em;">๐จ BadgeCraft - Beautiful Badge Generator</h1>
|
| 45 |
<p style="text-align: center; font-size: 1.1em; color: #555;">Design stylish shields.io badges with live preview and HTML snippet generation.</p>
|
|
|
|
| 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">
|
|
|
|
| 84 |
</div>
|
| 85 |
""")
|
| 86 |
|
| 87 |
+
# ์ถ๋ ฅ ์ปดํฌ๋ํธ
|
| 88 |
with gr.Row():
|
| 89 |
out_code = gr.Code(label="HTML Snippet", language="html")
|
| 90 |
out_preview = gr.HTML(label="Badge Preview")
|
| 91 |
|
| 92 |
+
# ์
๋ ฅ ์ปดํฌ๋ํธ
|
| 93 |
with gr.Row():
|
| 94 |
label = gr.Textbox(label="Label", placeholder="์: build")
|
| 95 |
message = gr.Textbox(label="Message", placeholder="์: passing")
|
| 96 |
logo = gr.Textbox(label="Logo", placeholder="์: github")
|
|
|
|
| 97 |
with gr.Row():
|
| 98 |
color = gr.ColorPicker(label="Color", value="#a0c4ff")
|
| 99 |
label_color = gr.ColorPicker(label="Label Color", value="#bdb2ff")
|
| 100 |
logo_color = gr.ColorPicker(label="Logo Color", value="#ffc6ff")
|
|
|
|
| 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 |
+
# Examples ๋ฐ์ดํฐ (8๊ฐ ํ๋ ์์๋๋ก)
|
| 105 |
+
examples = [
|
| 106 |
+
["Discord", "5865F2", "", "", "discord", "white", "for-the-badge", "https://discord.gg/openfreeai"],
|
| 107 |
+
["X.com", "000000", "", "", "X", "white", "for-the-badge", "https://x.com/openfree_ai"],
|
| 108 |
+
["Collections","F8F8F8", "", "", "huggingface","black", "for-the-badge", "https://huggingface.co/collections/VIDraft/best-open-ai-services-68057e6e312880ea92abaf4c"],
|
| 109 |
+
["VIDraft", "FCD022", "", "", "huggingface","black", "for-the-badge", "https://huggingface.co/VIDraft"],
|
| 110 |
+
["GitHub", "181717", "", "", "github", "white", "for-the-badge", "https://github.com/openfreeai"],
|
| 111 |
+
["Twitter", "1DA1F2", "", "", "twitter", "white", "for-the-badge", "https://twitter.com/openfree_ai"],
|
| 112 |
+
["YouTube", "FF0000", "", "", "youtube", "white", "for-the-badge", "https://www.youtube.com/@AITechTree"],
|
| 113 |
+
["Instagram", "E4405F", "", "", "instagram", "white", "for-the-badge", "https://www.instagram.com/openfree_ai"],
|
| 114 |
+
["Threads", "000000", "", "", "threads", "white", "for-the-badge", "https://www.threads.net/@openfree_ai"],
|
| 115 |
+
["Facebook", "1877F2", "", "", "facebook", "white", "for-the-badge", "https://www.facebook.com/profile.php?id=61575353674679"],
|
| 116 |
+
]
|
| 117 |
+
|
| 118 |
+
gr.HTML("<h3 style='text-align: center; margin-top: 30px;'>โจ Click an example to autofill</h3>")
|
| 119 |
+
gr.Examples(
|
| 120 |
+
examples=examples,
|
| 121 |
+
inputs=[label, message, color, label_color, logo, logo_color, style, link],
|
| 122 |
+
outputs=[out_code, out_preview],
|
| 123 |
+
fn=generate_static_badge,
|
| 124 |
+
cache_examples=False,
|
| 125 |
+
run_on_click=True
|
| 126 |
+
)
|
| 127 |
+
|
| 128 |
+
# ์ค์๊ฐ change ์ด๋ฒคํธ ๋ฐ์ธ๋ฉ
|
| 129 |
inputs = [label, message, color, label_color, logo, logo_color, style, link]
|
| 130 |
for inp in inputs:
|
| 131 |
inp.change(fn=generate_static_badge, inputs=inputs, outputs=[out_code, out_preview])
|