prithivMLmods commited on
Commit
bf60ef8
Β·
verified Β·
1 Parent(s): 31984b3

update app

Browse files
Files changed (1) hide show
  1. app.py +73 -1
app.py CHANGED
@@ -26,6 +26,78 @@ from reportlab.lib.styles import getSampleStyleSheet
26
  from reportlab.platypus import SimpleDocTemplate, Image as RLImage, Paragraph, Spacer
27
  from reportlab.lib.units import inch
28
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  # --- Constants and Model Setup ---
30
  MAX_INPUT_TOKEN_LENGTH = 4096
31
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
@@ -220,7 +292,7 @@ def create_gradio_interface():
220
  .process-button:hover { background-color: darkblue !important; transform: translateY(-2px) !important; box-shadow: 0 4px 8px rgba(0,0,0,0.2) !important; }
221
  #gallery { min-height: 400px; }
222
  """
223
- with gr.Blocks(theme="bethecloud/storj_theme", css=css) as demo:
224
  gr.HTML(f"""
225
  <div class="title" style="text-align: center">
226
  <h1>Document Conversion with POINTS Reader πŸ“–</h1>
 
26
  from reportlab.platypus import SimpleDocTemplate, Image as RLImage, Paragraph, Spacer
27
  from reportlab.lib.units import inch
28
 
29
+ from transformers.image_utils import load_image
30
+ from gradio.themes import Soft
31
+ from gradio.themes.utils import colors, fonts, sizes
32
+
33
+ colors.steel_blue = colors.Color(
34
+ name="steel_blue",
35
+ c50="#EBF3F8",
36
+ c100="#D3E5F0",
37
+ c200="#A8CCE1",
38
+ c300="#7DB3D2",
39
+ c400="#529AC3",
40
+ c500="#4682B4",
41
+ c600="#3E72A0",
42
+ c700="#36638C",
43
+ c800="#2E5378",
44
+ c900="#264364",
45
+ c950="#1E3450",
46
+ )
47
+
48
+ class SteelBlueTheme(Soft):
49
+ def __init__(
50
+ self,
51
+ *,
52
+ primary_hue: colors.Color | str = colors.gray,
53
+ secondary_hue: colors.Color | str = colors.steel_blue,
54
+ neutral_hue: colors.Color | str = colors.slate,
55
+ text_size: sizes.Size | str = sizes.text_lg,
56
+ font: fonts.Font | str | Iterable[fonts.Font | str] = (
57
+ fonts.GoogleFont("Outfit"), "Arial", "sans-serif",
58
+ ),
59
+ font_mono: fonts.Font | str | Iterable[fonts.Font | str] = (
60
+ fonts.GoogleFont("IBM Plex Mono"), "ui-monospace", "monospace",
61
+ ),
62
+ ):
63
+ super().__init__(
64
+ primary_hue=primary_hue,
65
+ secondary_hue=secondary_hue,
66
+ neutral_hue=neutral_hue,
67
+ text_size=text_size,
68
+ font=font,
69
+ font_mono=font_mono,
70
+ )
71
+ super().set(
72
+ background_fill_primary="*primary_50",
73
+ background_fill_primary_dark="*primary_900",
74
+ body_background_fill="linear-gradient(135deg, *primary_200, *primary_100)",
75
+ body_background_fill_dark="linear-gradient(135deg, *primary_900, *primary_800)",
76
+ button_primary_text_color="white",
77
+ button_primary_text_color_hover="white",
78
+ button_primary_background_fill="linear-gradient(90deg, *secondary_500, *secondary_600)",
79
+ button_primary_background_fill_hover="linear-gradient(90deg, *secondary_600, *secondary_700)",
80
+ button_primary_background_fill_dark="linear-gradient(90deg, *secondary_600, *secondary_800)",
81
+ button_primary_background_fill_hover_dark="linear-gradient(90deg, *secondary_500, *secondary_500)",
82
+ button_secondary_text_color="black",
83
+ button_secondary_text_color_hover="white",
84
+ button_secondary_background_fill="linear-gradient(90deg, *primary_300, *primary_300)",
85
+ button_secondary_background_fill_hover="linear-gradient(90deg, *primary_400, *primary_400)",
86
+ button_secondary_background_fill_dark="linear-gradient(90deg, *primary_500, *primary_600)",
87
+ button_secondary_background_fill_hover_dark="linear-gradient(90deg, *primary_500, *primary_500)",
88
+ slider_color="*secondary_500",
89
+ slider_color_dark="*secondary_600",
90
+ block_title_text_weight="600",
91
+ block_border_width="3px",
92
+ block_shadow="*shadow_drop_lg",
93
+ button_primary_shadow="*shadow_drop_lg",
94
+ button_large_padding="11px",
95
+ color_accent_soft="*primary_100",
96
+ block_label_background_fill="*primary_200",
97
+ )
98
+
99
+ steel_blue_theme = SteelBlueTheme()
100
+
101
  # --- Constants and Model Setup ---
102
  MAX_INPUT_TOKEN_LENGTH = 4096
103
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
 
292
  .process-button:hover { background-color: darkblue !important; transform: translateY(-2px) !important; box-shadow: 0 4px 8px rgba(0,0,0,0.2) !important; }
293
  #gallery { min-height: 400px; }
294
  """
295
+ with gr.Blocks(theme=steel_blue_theme, css=css) as demo:
296
  gr.HTML(f"""
297
  <div class="title" style="text-align: center">
298
  <h1>Document Conversion with POINTS Reader πŸ“–</h1>