Update app.py
Browse files
app.py
CHANGED
|
@@ -67,28 +67,28 @@ with gr.Blocks(theme=gr.themes.Default()) as demo:
|
|
| 67 |
message = gr.Textbox(label="Message", placeholder="e.g. passing", value="Join our community")
|
| 68 |
logo = gr.Textbox(label="Logo", placeholder="e.g. github", value="discord")
|
| 69 |
with gr.Row():
|
| 70 |
-
color = gr.ColorPicker(label="Color", value="#
|
| 71 |
-
label_color = gr.ColorPicker(label="Label Color", value="#
|
| 72 |
logo_color = gr.ColorPicker(label="Logo Color", value="white")
|
| 73 |
style = gr.Dropdown(label="Style", choices=["flat","flat-square","plastic","for-the-badge","social"], value="for-the-badge")
|
| 74 |
link = gr.Textbox(label="Link (URL)", placeholder="https://example.com", value="https://discord.gg/openfreeai")
|
| 75 |
|
| 76 |
-
# Example presets (click to autofill)
|
| 77 |
examples = [
|
| 78 |
-
["Discord","Join our community","#
|
| 79 |
-
["X.com","Follow us","#1DA1F2","#
|
| 80 |
-
["Collections","Explore","#
|
| 81 |
-
["GitHub","Star us","#
|
| 82 |
-
["YouTube","Watch now","#
|
| 83 |
-
["Facebook","Like us","#1877F2","#
|
| 84 |
-
["Instagram","Follow","#E4405F","#
|
| 85 |
-
["Threads","Join the convo","#000000","#
|
| 86 |
]
|
| 87 |
gr.HTML("<h3 style='text-align:center; margin-top:20px;'>✨ Examples (click to autofill)</h3>")
|
| 88 |
gr.Examples(
|
| 89 |
examples=examples,
|
| 90 |
-
inputs=[label,message,color,label_color,logo,logo_color,style,link],
|
| 91 |
-
outputs=[out_code,out_preview],
|
| 92 |
fn=generate_static_badge,
|
| 93 |
cache_examples=False,
|
| 94 |
run_on_click=True
|
|
@@ -97,13 +97,13 @@ with gr.Blocks(theme=gr.themes.Default()) as demo:
|
|
| 97 |
# On-load default preview
|
| 98 |
demo.load(
|
| 99 |
fn=generate_static_badge,
|
| 100 |
-
inputs=[label,message,color,label_color,logo,logo_color,style,link],
|
| 101 |
-
outputs=[out_code,out_preview]
|
| 102 |
)
|
| 103 |
|
| 104 |
# Live update on change
|
| 105 |
-
for inp in [label,message,color,label_color,logo,logo_color,style,link]:
|
| 106 |
-
inp.change(fn=generate_static_badge, inputs=[label,message,color,label_color,logo,logo_color,style,link], outputs=[out_code,out_preview])
|
| 107 |
|
| 108 |
if __name__ == "__main__":
|
| 109 |
-
demo.launch()
|
|
|
|
| 67 |
message = gr.Textbox(label="Message", placeholder="e.g. passing", value="Join our community")
|
| 68 |
logo = gr.Textbox(label="Logo", placeholder="e.g. github", value="discord")
|
| 69 |
with gr.Row():
|
| 70 |
+
color = gr.ColorPicker(label="Color", value="#5865F2") # Discord neon blue
|
| 71 |
+
label_color = gr.ColorPicker(label="Label Color", value="#99AAFF")
|
| 72 |
logo_color = gr.ColorPicker(label="Logo Color", value="white")
|
| 73 |
style = gr.Dropdown(label="Style", choices=["flat","flat-square","plastic","for-the-badge","social"], value="for-the-badge")
|
| 74 |
link = gr.Textbox(label="Link (URL)", placeholder="https://example.com", value="https://discord.gg/openfreeai")
|
| 75 |
|
| 76 |
+
# Example presets (click to autofill) with neon/vibrant colors
|
| 77 |
examples = [
|
| 78 |
+
["Discord", "Join our community", "#5865F2", "#99AAFF", "discord", "white", "for-the-badge", "https://discord.gg/openfreeai"],
|
| 79 |
+
["X.com", "Follow us", "#1DA1F2", "#00CFFF", "X", "white", "for-the-badge", "https://x.com/openfree_ai"],
|
| 80 |
+
["Collections","Explore", "#FFB300", "#FFF176", "huggingface","black","for-the-badge","https://huggingface.co/collections/VIDraft/best-open-ai-services-68057e6e312880ea92abaf4c"],
|
| 81 |
+
["GitHub", "Star us", "#0A0A0A", "#39FF14", "github", "white", "for-the-badge", "https://github.com/openfreeai"],
|
| 82 |
+
["YouTube", "Watch now", "#E50000", "#FF5E5E", "youtube", "white", "for-the-badge", "https://www.youtube.com/@AITechTree"],
|
| 83 |
+
["Facebook","Like us", "#1877F2", "#6FAFFF", "facebook", "white", "for-the-badge", "https://www.facebook.com/profile.php?id=61575353674679"],
|
| 84 |
+
["Instagram","Follow", "#E4405F", "#FF77A9", "instagram", "white", "for-the-badge", "https://www.instagram.com/openfree_ai/"],
|
| 85 |
+
["Threads", "Join the convo", "#000000", "#FF00FF", "threads", "white", "for-the-badge", "https://www.threads.net/@openfree_ai"],
|
| 86 |
]
|
| 87 |
gr.HTML("<h3 style='text-align:center; margin-top:20px;'>✨ Examples (click to autofill)</h3>")
|
| 88 |
gr.Examples(
|
| 89 |
examples=examples,
|
| 90 |
+
inputs=[label, message, color, label_color, logo, logo_color, style, link],
|
| 91 |
+
outputs=[out_code, out_preview],
|
| 92 |
fn=generate_static_badge,
|
| 93 |
cache_examples=False,
|
| 94 |
run_on_click=True
|
|
|
|
| 97 |
# On-load default preview
|
| 98 |
demo.load(
|
| 99 |
fn=generate_static_badge,
|
| 100 |
+
inputs=[label, message, color, label_color, logo, logo_color, style, link],
|
| 101 |
+
outputs=[out_code, out_preview]
|
| 102 |
)
|
| 103 |
|
| 104 |
# Live update on change
|
| 105 |
+
for inp in [label, message, color, label_color, logo, logo_color, style, link]:
|
| 106 |
+
inp.change(fn=generate_static_badge, inputs=[label, message, color, label_color, logo, logo_color, style, link], outputs=[out_code, out_preview])
|
| 107 |
|
| 108 |
if __name__ == "__main__":
|
| 109 |
+
demo.launch()
|