fantos commited on
Commit
ce9a842
·
verified ·
1 Parent(s): cdbdc73

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -18
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="#7289DA")
71
- label_color = gr.ColorPicker(label="Label Color", value="#99AAB5")
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","#7289DA","#99AAB5","discord","white","for-the-badge","https://discord.gg/openfreeai"],
79
- ["X.com","Follow us","#1DA1F2","#A8D0E6","X","white","for-the-badge","https://x.com/openfree_ai"],
80
- ["Collections","Explore","#F9A826","#FBF3A1","huggingface","black","for-the-badge","https://huggingface.co/collections/VIDraft/best-open-ai-services-68057e6e312880ea92abaf4c"],
81
- ["GitHub","Star us","#181717","#B0B0B0","github","white","for-the-badge","https://github.com/openfreeai"],
82
- ["YouTube","Watch now","#FF0000","#FFA3A3","youtube","white","for-the-badge","https://www.youtube.com/@AITechTree"],
83
- ["Facebook","Like us","#1877F2","#A3C4F0","facebook","white","for-the-badge","https://www.facebook.com/profile.php?id=61575353674679"],
84
- ["Instagram","Follow","#E4405F","#F5A3B1","instagram","white","for-the-badge","https://www.instagram.com/openfree_ai/"],
85
- ["Threads","Join the convo","#000000","#CCCCCC","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,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()