abhidgp1978 commited on
Commit
ca6d467
Β·
verified Β·
1 Parent(s): f246a1b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +57 -26
app.py CHANGED
@@ -9,9 +9,9 @@ GROQ_API_URL = "https://api.groq.com/openai/v1/chat/completions"
9
  # ===============================
10
  # πŸ”§ Usage Limit Configuration
11
  # ===============================
12
- ENABLE_IP_LIMIT = True # πŸ‘ˆ Comment/Set False to disable IP limiting
13
- MAX_USES = 1 # πŸ‘ˆ Maximum allowed actions per IP
14
- USAGE_FILE = "ip_usage.json" # πŸ‘ˆ Persistent storage file
15
  # ===============================
16
 
17
  if not GROQ_API_KEY:
@@ -62,15 +62,14 @@ def groq_api_chat(prompt, model="llama3-8b-8192", max_tokens=800):
62
  # Helpers
63
  # -------------------------------
64
  def get_component_updates(interactive_state: bool):
65
- """Returns a tuple of gr.update objects for all interactive components."""
66
  upd = gr.update(interactive=interactive_state)
67
  return (
68
- upd, upd, upd, # run_btn, generate_hashtags_btn, launch_btn
69
- upd, # product_name
70
- upd, upd, upd, upd, upd, upd, # 6 checkboxes
71
- upd, # social_channels
72
- upd, # hashtags textbox
73
- upd # launch_checkbox
74
  )
75
 
76
  def enforce_limit(request: gr.Request):
@@ -217,32 +216,64 @@ def social_channel_launch(request: gr.Request, channel, hashtags, checkbox_value
217
  # UI
218
  # -------------------------------
219
  CSS = """
 
 
 
 
 
 
 
 
 
220
  body {
221
- background-color: black !important;
222
- color: white !important;
223
  }
 
 
224
  .gradio-container {
225
- background-color: black !important;
226
- color: white !important;
 
 
227
  }
228
- .gr-text-input, .gr-dropdown, .gr-button {
229
- color: white !important;
230
- background-color: #222 !important;
231
- border-color: #555 !important;
 
 
 
 
 
 
 
232
  }
 
 
233
  .gr-button {
234
- box-shadow: 0 0 5px #00f, 0 0 10px #00f, 0 0 15px #00f;
235
- transition: box-shadow 0.3s ease-in-out;
 
 
 
236
  }
237
  .gr-button:hover {
238
- box-shadow: 0 0 10px #00f, 0 0 20px #00f, 0 0 30px #00f;
239
- }
240
- .gr-checkbox, .gr-checkbox-group {
241
- color: white !important;
242
  }
 
 
243
  .gradio-container h1, .gradio-container h2, .gradio-container label, .gradio-container p {
244
- color: white !important;
245
- text-shadow: 0 0 5px #00f, 0 0 10px #00f, 0 0 15px #00f;
 
 
 
 
 
 
 
246
  }
247
  """
248
 
 
9
  # ===============================
10
  # πŸ”§ Usage Limit Configuration
11
  # ===============================
12
+ ENABLE_IP_LIMIT = True
13
+ MAX_USES = 1
14
+ USAGE_FILE = "ip_usage.json"
15
  # ===============================
16
 
17
  if not GROQ_API_KEY:
 
62
  # Helpers
63
  # -------------------------------
64
  def get_component_updates(interactive_state: bool):
 
65
  upd = gr.update(interactive=interactive_state)
66
  return (
67
+ upd, upd, upd,
68
+ upd,
69
+ upd, upd, upd, upd, upd, upd,
70
+ upd,
71
+ upd,
72
+ upd
73
  )
74
 
75
  def enforce_limit(request: gr.Request):
 
216
  # UI
217
  # -------------------------------
218
  CSS = """
219
+ /* Set the primary colors */
220
+ :root {
221
+ --bg-color: #0d1117;
222
+ --text-color: #c9d1d9;
223
+ --border-color: #30363d;
224
+ --primary-color: #58a6ff;
225
+ --secondary-color: #4a5665;
226
+ }
227
+
228
  body {
229
+ background-color: var(--bg-color) !important;
230
+ color: var(--text-color) !important;
231
  }
232
+
233
+ /* General container and card styling */
234
  .gradio-container {
235
+ background-color: var(--bg-color) !important;
236
+ color: var(--text-color) !important;
237
+ border: none;
238
+ box-shadow: none;
239
  }
240
+
241
+ .gradio-container .block {
242
+ border-color: var(--border-color) !important;
243
+ background-color: var(--bg-color) !important;
244
+ }
245
+
246
+ /* Input components */
247
+ .gr-text-input, .gr-dropdown, .gr-checkbox-group, .gr-checkbox-label {
248
+ background-color: var(--bg-color) !important;
249
+ border-color: var(--border-color) !important;
250
+ color: var(--text-color) !important;
251
  }
252
+
253
+ /* Button styling */
254
  .gr-button {
255
+ background-color: var(--secondary-color) !important;
256
+ color: var(--text-color) !important;
257
+ border: 1px solid var(--primary-color) !important;
258
+ font-weight: bold;
259
+ border-radius: 4px;
260
  }
261
  .gr-button:hover {
262
+ background-color: var(--primary-color) !important;
263
+ color: var(--bg-color) !important;
 
 
264
  }
265
+
266
+ /* Headings and labels */
267
  .gradio-container h1, .gradio-container h2, .gradio-container label, .gradio-container p {
268
+ color: var(--text-color) !important;
269
+ font-weight: bold;
270
+ }
271
+
272
+ /* Specific Markdown for outputs */
273
+ .gradio-container .gr-markdown, .gradio-container .gr-markdown-container {
274
+ background-color: var(--bg-color) !important;
275
+ color: var(--text-color) !important;
276
+ border-color: var(--border-color) !important;
277
  }
278
  """
279