prithivMLmods commited on
Commit
d87c89f
·
verified ·
1 Parent(s): c692b6e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +53 -53
app.py CHANGED
@@ -12,27 +12,27 @@ from transformers.image_utils import load_image
12
  from gradio.themes import Soft
13
  from gradio.themes.utils import colors, fonts, sizes
14
 
15
- colors.orange_red = colors.Color(
16
- name="orange_red",
17
- c50="#FFF0E5",
18
- c100="#FFE0CC",
19
- c200="#FFC299",
20
- c300="#FFA366",
21
- c400="#FF8533",
22
- c500="#FF4500",
23
- c600="#E63E00",
24
- c700="#CC3700",
25
- c800="#B33000",
26
- c900="#992900",
27
- c950="#802200",
28
  )
29
 
30
- class OrangeRedTheme(Soft):
31
  def __init__(
32
  self,
33
  *,
34
  primary_hue: colors.Color | str = colors.gray,
35
- secondary_hue: colors.Color | str = colors.orange_red,
36
  neutral_hue: colors.Color | str = colors.slate,
37
  text_size: sizes.Size | str = sizes.text_lg,
38
  font: fonts.Font | str | Iterable[fonts.Font | str] = (
@@ -78,7 +78,7 @@ class OrangeRedTheme(Soft):
78
  block_label_background_fill="*primary_200",
79
  )
80
 
81
- orange_red_theme = OrangeRedTheme()
82
 
83
  MODEL_PATH = "zai-org/GLM-OCR"
84
 
@@ -145,12 +145,12 @@ def process_image(image, task):
145
  css = """
146
  @import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');
147
 
148
- /* Background grid pattern */
149
  body, .gradio-container {
150
- background-color: #FFF5EB !important;
151
  background-image:
152
- linear-gradient(#FFE0CC 1px, transparent 1px),
153
- linear-gradient(90deg, #FFE0CC 1px, transparent 1px) !important;
154
  background-size: 40px 40px !important;
155
  font-family: 'Outfit', sans-serif !important;
156
  }
@@ -159,8 +159,8 @@ body, .gradio-container {
159
  .dark body, .dark .gradio-container {
160
  background-color: #1a1a1a !important;
161
  background-image:
162
- linear-gradient(rgba(255, 69, 0, 0.1) 1px, transparent 1px),
163
- linear-gradient(90deg, rgba(255, 69, 0, 0.1) 1px, transparent 1px) !important;
164
  background-size: 40px 40px !important;
165
  }
166
 
@@ -178,7 +178,7 @@ body, .gradio-container {
178
  #main-title h1 {
179
  font-size: 2.5em !important;
180
  font-weight: 700 !important;
181
- background: linear-gradient(135deg, #FF4500 0%, #FF8533 50%, #E63E00 100%);
182
  background-size: 200% 200%;
183
  -webkit-background-clip: text;
184
  -webkit-text-fill-color: transparent;
@@ -205,7 +205,7 @@ body, .gradio-container {
205
  }
206
 
207
  #subtitle a {
208
- color: #FF4500 !important;
209
  text-decoration: none;
210
  font-weight: 500;
211
  }
@@ -217,34 +217,34 @@ body, .gradio-container {
217
  /* Card styling */
218
  .gradio-group {
219
  background: rgba(255, 255, 255, 0.9) !important;
220
- border: 2px solid #FFE0CC !important;
221
  border-radius: 12px !important;
222
- box-shadow: 0 4px 24px rgba(255, 69, 0, 0.08) !important;
223
  backdrop-filter: blur(10px);
224
  transition: all 0.3s ease;
225
  }
226
 
227
  .gradio-group:hover {
228
- box-shadow: 0 8px 32px rgba(255, 69, 0, 0.12) !important;
229
- border-color: #FFC299 !important;
230
  }
231
 
232
  .dark .gradio-group {
233
  background: rgba(30, 30, 30, 0.9) !important;
234
- border-color: rgba(255, 69, 0, 0.3) !important;
235
  }
236
 
237
  /* Image upload area */
238
  .gradio-image {
239
  border-radius: 10px !important;
240
  overflow: hidden;
241
- border: 2px dashed #FFC299 !important;
242
  transition: all 0.3s ease;
243
  }
244
 
245
  .gradio-image:hover {
246
- border-color: #FF4500 !important;
247
- background: rgba(255, 69, 0, 0.02) !important;
248
  }
249
 
250
  /* Radio buttons */
@@ -259,12 +259,12 @@ body, .gradio-container {
259
  }
260
 
261
  .gradio-radio label:hover {
262
- background: rgba(255, 69, 0, 0.05) !important;
263
  }
264
 
265
  .gradio-radio label.selected {
266
- background: rgba(255, 69, 0, 0.1) !important;
267
- border-color: #FF4500 !important;
268
  }
269
 
270
  /* Primary button */
@@ -282,7 +282,7 @@ body, .gradio-container {
282
 
283
  /* Tabs styling */
284
  .tab-nav {
285
- border-bottom: 2px solid #FFE0CC !important;
286
  }
287
 
288
  .tab-nav button {
@@ -293,8 +293,8 @@ body, .gradio-container {
293
  }
294
 
295
  .tab-nav button.selected {
296
- background: rgba(255, 69, 0, 0.1) !important;
297
- border-bottom: 2px solid #FF4500 !important;
298
  }
299
 
300
  /* Output textbox */
@@ -303,13 +303,13 @@ body, .gradio-container {
303
  font-size: 0.95rem !important;
304
  line-height: 1.7 !important;
305
  background: rgba(255, 255, 255, 0.95) !important;
306
- border: 1px solid #FFE0CC !important;
307
  border-radius: 8px !important;
308
  }
309
 
310
  .dark .gradio-textbox textarea {
311
  background: rgba(30, 30, 30, 0.95) !important;
312
- border-color: rgba(255, 69, 0, 0.2) !important;
313
  }
314
 
315
  /* Markdown output */
@@ -320,15 +320,15 @@ body, .gradio-container {
320
 
321
  .gradio-markdown code {
322
  font-family: 'IBM Plex Mono', monospace !important;
323
- background: rgba(255, 69, 0, 0.08) !important;
324
  padding: 2px 6px !important;
325
  border-radius: 4px !important;
326
- color: #CC3700 !important;
327
  }
328
 
329
  .gradio-markdown pre {
330
- background: rgba(255, 69, 0, 0.05) !important;
331
- border: 1px solid #FFE0CC !important;
332
  border-radius: 8px !important;
333
  padding: 1rem !important;
334
  }
@@ -339,15 +339,15 @@ body, .gradio-container {
339
  }
340
 
341
  .gradio-examples .gallery-item {
342
- border: 2px solid #FFE0CC !important;
343
  border-radius: 8px !important;
344
  transition: all 0.2s ease !important;
345
  }
346
 
347
  .gradio-examples .gallery-item:hover {
348
- border-color: #FF4500 !important;
349
  transform: translateY(-2px) !important;
350
- box-shadow: 0 4px 12px rgba(255, 69, 0, 0.15) !important;
351
  }
352
 
353
  /* Scrollbar styling */
@@ -357,27 +357,27 @@ body, .gradio-container {
357
  }
358
 
359
  ::-webkit-scrollbar-track {
360
- background: rgba(255, 69, 0, 0.05);
361
  border-radius: 4px;
362
  }
363
 
364
  ::-webkit-scrollbar-thumb {
365
- background: linear-gradient(135deg, #FF4500, #FF8533);
366
  border-radius: 4px;
367
  }
368
 
369
  ::-webkit-scrollbar-thumb:hover {
370
- background: linear-gradient(135deg, #E63E00, #FF4500);
371
  }
372
 
373
  /* Accordion styling */
374
  .gradio-accordion {
375
  border-radius: 10px !important;
376
- border: 1px solid #FFE0CC !important;
377
  }
378
 
379
  .gradio-accordion > .label-wrap {
380
- background: rgba(255, 69, 0, 0.03) !important;
381
  border-radius: 10px !important;
382
  }
383
 
@@ -466,4 +466,4 @@ with gr.Blocks() as demo:
466
  )
467
 
468
  if __name__ == "__main__":
469
- demo.queue(max_size=50).launch(css=css, theme=orange_red_theme, mcp_server=True, ssr_mode=False, show_error=True)
 
12
  from gradio.themes import Soft
13
  from gradio.themes.utils import colors, fonts, sizes
14
 
15
+ colors.hot_pink = colors.Color(
16
+ name="hot_pink",
17
+ c50="#FFF0F5",
18
+ c100="#FFE4EC",
19
+ c200="#FFC0D9",
20
+ c300="#FF99C4",
21
+ c400="#FF7EB8",
22
+ c500="#FF69B4",
23
+ c600="#E55AA0",
24
+ c700="#CC4C8C",
25
+ c800="#B33D78",
26
+ c900="#992F64",
27
+ c950="#802050",
28
  )
29
 
30
+ class HotPinkTheme(Soft):
31
  def __init__(
32
  self,
33
  *,
34
  primary_hue: colors.Color | str = colors.gray,
35
+ secondary_hue: colors.Color | str = colors.hot_pink,
36
  neutral_hue: colors.Color | str = colors.slate,
37
  text_size: sizes.Size | str = sizes.text_lg,
38
  font: fonts.Font | str | Iterable[fonts.Font | str] = (
 
78
  block_label_background_fill="*primary_200",
79
  )
80
 
81
+ hot_pink_theme = HotPinkTheme()
82
 
83
  MODEL_PATH = "zai-org/GLM-OCR"
84
 
 
145
  css = """
146
  @import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');
147
 
148
+ /* Background grid pattern - Hot Pink theme */
149
  body, .gradio-container {
150
+ background-color: #FFF0F5 !important;
151
  background-image:
152
+ linear-gradient(#FFC0D9 1px, transparent 1px),
153
+ linear-gradient(90deg, #FFC0D9 1px, transparent 1px) !important;
154
  background-size: 40px 40px !important;
155
  font-family: 'Outfit', sans-serif !important;
156
  }
 
159
  .dark body, .dark .gradio-container {
160
  background-color: #1a1a1a !important;
161
  background-image:
162
+ linear-gradient(rgba(255, 105, 180, 0.1) 1px, transparent 1px),
163
+ linear-gradient(90deg, rgba(255, 105, 180, 0.1) 1px, transparent 1px) !important;
164
  background-size: 40px 40px !important;
165
  }
166
 
 
178
  #main-title h1 {
179
  font-size: 2.5em !important;
180
  font-weight: 700 !important;
181
+ background: linear-gradient(135deg, #FF69B4 0%, #FF99C4 50%, #E55AA0 100%);
182
  background-size: 200% 200%;
183
  -webkit-background-clip: text;
184
  -webkit-text-fill-color: transparent;
 
205
  }
206
 
207
  #subtitle a {
208
+ color: #FF69B4 !important;
209
  text-decoration: none;
210
  font-weight: 500;
211
  }
 
217
  /* Card styling */
218
  .gradio-group {
219
  background: rgba(255, 255, 255, 0.9) !important;
220
+ border: 2px solid #FFC0D9 !important;
221
  border-radius: 12px !important;
222
+ box-shadow: 0 4px 24px rgba(255, 105, 180, 0.08) !important;
223
  backdrop-filter: blur(10px);
224
  transition: all 0.3s ease;
225
  }
226
 
227
  .gradio-group:hover {
228
+ box-shadow: 0 8px 32px rgba(255, 105, 180, 0.12) !important;
229
+ border-color: #FF99C4 !important;
230
  }
231
 
232
  .dark .gradio-group {
233
  background: rgba(30, 30, 30, 0.9) !important;
234
+ border-color: rgba(255, 105, 180, 0.3) !important;
235
  }
236
 
237
  /* Image upload area */
238
  .gradio-image {
239
  border-radius: 10px !important;
240
  overflow: hidden;
241
+ border: 2px dashed #FF99C4 !important;
242
  transition: all 0.3s ease;
243
  }
244
 
245
  .gradio-image:hover {
246
+ border-color: #FF69B4 !important;
247
+ background: rgba(255, 105, 180, 0.02) !important;
248
  }
249
 
250
  /* Radio buttons */
 
259
  }
260
 
261
  .gradio-radio label:hover {
262
+ background: rgba(255, 105, 180, 0.05) !important;
263
  }
264
 
265
  .gradio-radio label.selected {
266
+ background: rgba(255, 105, 180, 0.1) !important;
267
+ border-color: #FF69B4 !important;
268
  }
269
 
270
  /* Primary button */
 
282
 
283
  /* Tabs styling */
284
  .tab-nav {
285
+ border-bottom: 2px solid #FFC0D9 !important;
286
  }
287
 
288
  .tab-nav button {
 
293
  }
294
 
295
  .tab-nav button.selected {
296
+ background: rgba(255, 105, 180, 0.1) !important;
297
+ border-bottom: 2px solid #FF69B4 !important;
298
  }
299
 
300
  /* Output textbox */
 
303
  font-size: 0.95rem !important;
304
  line-height: 1.7 !important;
305
  background: rgba(255, 255, 255, 0.95) !important;
306
+ border: 1px solid #FFC0D9 !important;
307
  border-radius: 8px !important;
308
  }
309
 
310
  .dark .gradio-textbox textarea {
311
  background: rgba(30, 30, 30, 0.95) !important;
312
+ border-color: rgba(255, 105, 180, 0.2) !important;
313
  }
314
 
315
  /* Markdown output */
 
320
 
321
  .gradio-markdown code {
322
  font-family: 'IBM Plex Mono', monospace !important;
323
+ background: rgba(255, 105, 180, 0.08) !important;
324
  padding: 2px 6px !important;
325
  border-radius: 4px !important;
326
+ color: #CC4C8C !important;
327
  }
328
 
329
  .gradio-markdown pre {
330
+ background: rgba(255, 105, 180, 0.05) !important;
331
+ border: 1px solid #FFC0D9 !important;
332
  border-radius: 8px !important;
333
  padding: 1rem !important;
334
  }
 
339
  }
340
 
341
  .gradio-examples .gallery-item {
342
+ border: 2px solid #FFC0D9 !important;
343
  border-radius: 8px !important;
344
  transition: all 0.2s ease !important;
345
  }
346
 
347
  .gradio-examples .gallery-item:hover {
348
+ border-color: #FF69B4 !important;
349
  transform: translateY(-2px) !important;
350
+ box-shadow: 0 4px 12px rgba(255, 105, 180, 0.15) !important;
351
  }
352
 
353
  /* Scrollbar styling */
 
357
  }
358
 
359
  ::-webkit-scrollbar-track {
360
+ background: rgba(255, 105, 180, 0.05);
361
  border-radius: 4px;
362
  }
363
 
364
  ::-webkit-scrollbar-thumb {
365
+ background: linear-gradient(135deg, #FF69B4, #FF99C4);
366
  border-radius: 4px;
367
  }
368
 
369
  ::-webkit-scrollbar-thumb:hover {
370
+ background: linear-gradient(135deg, #E55AA0, #FF69B4);
371
  }
372
 
373
  /* Accordion styling */
374
  .gradio-accordion {
375
  border-radius: 10px !important;
376
+ border: 1px solid #FFC0D9 !important;
377
  }
378
 
379
  .gradio-accordion > .label-wrap {
380
+ background: rgba(255, 105, 180, 0.03) !important;
381
  border-radius: 10px !important;
382
  }
383
 
 
466
  )
467
 
468
  if __name__ == "__main__":
469
+ demo.queue(max_size=50).launch(css=css, theme=hot_pink_theme, mcp_server=True, ssr_mode=False, show_error=True)