Update app.py
Browse files
app.py
CHANGED
|
@@ -29,7 +29,7 @@ def generate_static_badge(label, message, color, label_color, logo, logo_color,
|
|
| 29 |
html_code = f'<img src="{badge_url}" alt="badge">'
|
| 30 |
|
| 31 |
badge_preview = f"""
|
| 32 |
-
<div style='padding:
|
| 33 |
{html_code}
|
| 34 |
</div>
|
| 35 |
"""
|
|
@@ -39,9 +39,27 @@ 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.
|
| 43 |
-
|
| 44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
""")
|
| 46 |
|
| 47 |
out_code = gr.Code(label="HTML Snippet", language="html")
|
|
@@ -53,19 +71,17 @@ with gr.Blocks(theme=gr.themes.Default()) as demo:
|
|
| 53 |
logo = gr.Textbox(label="Logo", placeholder="์: github")
|
| 54 |
|
| 55 |
with gr.Row():
|
| 56 |
-
color = gr.ColorPicker(label="Color", value="#
|
| 57 |
-
label_color = gr.ColorPicker(label="Label Color", value="#
|
| 58 |
-
logo_color = gr.ColorPicker(label="Logo Color", value="#
|
| 59 |
|
| 60 |
-
style = gr.Dropdown(label="Style", choices=["flat", "flat-square", "plastic", "for-the-badge", "social"], value="
|
| 61 |
link = gr.Textbox(label="Link (๋ฐฐ์ง ํด๋ฆญ ์ ์ด๋ํ URL)", placeholder="https://yourlink.com")
|
| 62 |
|
| 63 |
inputs = [label, message, color, label_color, logo, logo_color, style, link]
|
| 64 |
for inp in inputs:
|
| 65 |
inp.change(fn=generate_static_badge, inputs=inputs, outputs=[out_code, out_preview])
|
| 66 |
|
| 67 |
-
# ์ด๊ธฐ๊ฐ ํ ๋ฒ ์ถ๋ ฅ
|
| 68 |
-
generate_static_badge("build", "passing", "#007ec6", "#555", "github", "#ffffff", "flat", "https://shields.io")
|
| 69 |
-
|
| 70 |
# ์คํ
|
| 71 |
-
|
|
|
|
|
|
| 29 |
html_code = f'<img src="{badge_url}" alt="badge">'
|
| 30 |
|
| 31 |
badge_preview = f"""
|
| 32 |
+
<div style='padding:20px; background: #fefefe; border-radius: 12px; text-align:center;'>
|
| 33 |
{html_code}
|
| 34 |
</div>
|
| 35 |
"""
|
|
|
|
| 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 |
+
<div align="center" style="font-weight: bold; margin-top: 20px; margin-bottom: 15px;">
|
| 47 |
+
<b>Papers Leaderboard: <a href="https://huggingface.co/spaces/Heartsync/Papers-Leaderboard">https://huggingface.co/spaces/Heartsync/Papers-Leaderboard</a></b>
|
| 48 |
+
</div>
|
| 49 |
+
<div align="center" style="line-height: 1.7;">
|
| 50 |
+
<a href="https://discord.gg/openfreeai" style="margin: 2px;">
|
| 51 |
+
<img alt="OpenFree AI Discord Server" src="https://img.shields.io/badge/Discord-5865F2?style=for-the-badge&logo=discord&logoColor=white" />
|
| 52 |
+
</a>
|
| 53 |
+
<a href="https://x.com/openfree_ai" style="margin: 2px;">
|
| 54 |
+
<img alt="X.ai" src="https://img.shields.io/badge/X.com-000000?style=for-the-badge&logo=X&logoColor=white" />
|
| 55 |
+
</a>
|
| 56 |
+
<a href="https://huggingface.co/collections/VIDraft/best-open-ai-services-68057e6e312880ea92abaf4c" style="margin: 2px;">
|
| 57 |
+
<img alt="Collections" src="https://img.shields.io/badge/Collections-F8F8F8?style=for-the-badge&logo=huggingface&logoColor=black" />
|
| 58 |
+
</a>
|
| 59 |
+
<a href="https://huggingface.co/VIDraft" style="margin: 2px;">
|
| 60 |
+
<img alt="HF Page" src="https://img.shields.io/badge/VIDraft-FCD022?style=for-the-badge&logo=huggingface&logoColor=black" />
|
| 61 |
+
</a>
|
| 62 |
+
</div>
|
| 63 |
""")
|
| 64 |
|
| 65 |
out_code = gr.Code(label="HTML Snippet", language="html")
|
|
|
|
| 71 |
logo = gr.Textbox(label="Logo", placeholder="์: github")
|
| 72 |
|
| 73 |
with gr.Row():
|
| 74 |
+
color = gr.ColorPicker(label="Color", value="#a0c4ff")
|
| 75 |
+
label_color = gr.ColorPicker(label="Label Color", value="#bdb2ff")
|
| 76 |
+
logo_color = gr.ColorPicker(label="Logo Color", value="#ffc6ff")
|
| 77 |
|
| 78 |
+
style = gr.Dropdown(label="Style", choices=["flat", "flat-square", "plastic", "for-the-badge", "social"], value="for-the-badge")
|
| 79 |
link = gr.Textbox(label="Link (๋ฐฐ์ง ํด๋ฆญ ์ ์ด๋ํ URL)", placeholder="https://yourlink.com")
|
| 80 |
|
| 81 |
inputs = [label, message, color, label_color, logo, logo_color, style, link]
|
| 82 |
for inp in inputs:
|
| 83 |
inp.change(fn=generate_static_badge, inputs=inputs, outputs=[out_code, out_preview])
|
| 84 |
|
|
|
|
|
|
|
|
|
|
| 85 |
# ์คํ
|
| 86 |
+
if __name__ == "__main__":
|
| 87 |
+
demo.launch()
|