GaetanoParente commited on
Commit
b9c5837
·
1 Parent(s): 4bdde62

fix style

Browse files
Files changed (3) hide show
  1. app.py +5 -5
  2. modules/utilities/utils.py +3 -9
  3. style.css +111 -13
app.py CHANGED
@@ -182,7 +182,7 @@ with gr.Blocks(title="NGT AI Platform", theme=theme, css_paths="style.css") as d
182
  Modulo interattivo per la pianificazione dei turni. Confronta in tempo reale il forecast AI con i dati storici effettivi.
183
  """)
184
 
185
- with gr.Row():
186
  with gr.Column(scale=1):
187
  with gr.Group():
188
  gr.Markdown("### 1. Configurazione")
@@ -232,7 +232,7 @@ with gr.Blocks(title="NGT AI Platform", theme=theme, css_paths="style.css") as d
232
  """)
233
 
234
  # 3. INTERFACCIA
235
- with gr.Row():
236
  with gr.Column():
237
  # Input Text
238
  sentiment_input = gr.Textbox(
@@ -280,7 +280,7 @@ with gr.Blocks(title="NGT AI Platform", theme=theme, css_paths="style.css") as d
280
  * **Tecnologia:** Deep Learning su sequenze di testo (Embedding layer).
281
  """)
282
 
283
- with gr.Row():
284
  # COLONNA INPUT (L'Articolo)
285
  with gr.Column(scale=3):
286
  multi_input = gr.Textbox(
@@ -328,7 +328,7 @@ with gr.Blocks(title="NGT AI Platform", theme=theme, css_paths="style.css") as d
328
  *Utilizzare gli esempi di radiografiche frontali (Chest X-Ray) recuperabili nella sidebar laterale.*
329
  """)
330
 
331
- with gr.Row():
332
  # COLONNA INPUT
333
  with gr.Column(scale=1):
334
  image_input = gr.Image(type="numpy", label="Seleziona Radiografia", height=400, interactive=False)
@@ -351,7 +351,7 @@ with gr.Blocks(title="NGT AI Platform", theme=theme, css_paths="style.css") as d
351
  *Utilizzare gli esempi di retinografie digitali recuperabili nella sidebar laterale.*
352
  """)
353
 
354
- with gr.Row():
355
  # COLONNA INPUT
356
  with gr.Column(scale=1):
357
  image_input_dr = gr.Image(
 
182
  Modulo interattivo per la pianificazione dei turni. Confronta in tempo reale il forecast AI con i dati storici effettivi.
183
  """)
184
 
185
+ with gr.Row(elem_classes="responsive-row"):
186
  with gr.Column(scale=1):
187
  with gr.Group():
188
  gr.Markdown("### 1. Configurazione")
 
232
  """)
233
 
234
  # 3. INTERFACCIA
235
+ with gr.Row(elem_classes="responsive-row"):
236
  with gr.Column():
237
  # Input Text
238
  sentiment_input = gr.Textbox(
 
280
  * **Tecnologia:** Deep Learning su sequenze di testo (Embedding layer).
281
  """)
282
 
283
+ with gr.Row(elem_classes="responsive-row"):
284
  # COLONNA INPUT (L'Articolo)
285
  with gr.Column(scale=3):
286
  multi_input = gr.Textbox(
 
328
  *Utilizzare gli esempi di radiografiche frontali (Chest X-Ray) recuperabili nella sidebar laterale.*
329
  """)
330
 
331
+ with gr.Row(elem_classes="responsive-row"):
332
  # COLONNA INPUT
333
  with gr.Column(scale=1):
334
  image_input = gr.Image(type="numpy", label="Seleziona Radiografia", height=400, interactive=False)
 
351
  *Utilizzare gli esempi di retinografie digitali recuperabili nella sidebar laterale.*
352
  """)
353
 
354
+ with gr.Row(elem_classes="responsive-row"):
355
  # COLONNA INPUT
356
  with gr.Column(scale=1):
357
  image_input_dr = gr.Image(
modules/utilities/utils.py CHANGED
@@ -27,7 +27,6 @@ def global_file_loader(file_data):
27
  Gestisce il caricamento file dalla Sidebar.
28
  Supporta sia input stringa (Gradio 5 single) che lista.
29
  """
30
- # 1. NORMALIZZAZIONE INPUT (Il Fix Cruciale)
31
  if isinstance(file_data, list):
32
  if not file_data:
33
  return [gr.update() for _ in range(6)]
@@ -40,7 +39,7 @@ def global_file_loader(file_data):
40
 
41
  ext = os.path.splitext(file_path)[1].lower()
42
 
43
- # Valori di default (non cambiare nulla)
44
  bpo_update = gr.update()
45
  forecast_update = gr.update()
46
  img_xray_update = gr.update()
@@ -61,21 +60,16 @@ def global_file_loader(file_data):
61
  content = f.read()
62
 
63
  elif ext in ['.csv']:
64
- # 1. Aggiorniamo il modulo Forecast (passando il PATH)
65
  forecast_update = gr.update(value=file_path)
66
-
67
- # 2. FIX ERRORE: Leggiamo il contenuto testuale per gli altri tab (opzionale)
68
- # Se non leggi il file qui, 'content' non esiste e dava errore.
69
  try:
70
  with open(file_path, "r", encoding="utf-8") as f:
71
  content = f.read()
72
 
73
- # Ora 'content' esiste e possiamo usarlo
74
  bpo_update = gr.Textbox(value=content)
75
  news_update = gr.Textbox(value=content)
76
  sentiment_update = gr.Textbox(value=content)
77
  except:
78
- # Se il CSV è illeggibile come testo, pazienza, non crashiamo
79
  pass
80
 
81
  except Exception as e:
@@ -95,7 +89,7 @@ def render_ner_html(entities):
95
  """
96
  Trasforma la lista [('testo', 'LABEL'), ('testo', None)] in HTML puro.
97
  """
98
- # Mappa colori HEX (più belli e moderni)
99
  colors = {
100
  "CODICE CLIENTE": "#3b82f6", # Blue 500
101
  "N. FATTURA": "#f97316", # Orange 500
 
27
  Gestisce il caricamento file dalla Sidebar.
28
  Supporta sia input stringa (Gradio 5 single) che lista.
29
  """
 
30
  if isinstance(file_data, list):
31
  if not file_data:
32
  return [gr.update() for _ in range(6)]
 
39
 
40
  ext = os.path.splitext(file_path)[1].lower()
41
 
42
+ # Valori di default
43
  bpo_update = gr.update()
44
  forecast_update = gr.update()
45
  img_xray_update = gr.update()
 
60
  content = f.read()
61
 
62
  elif ext in ['.csv']:
 
63
  forecast_update = gr.update(value=file_path)
64
+
 
 
65
  try:
66
  with open(file_path, "r", encoding="utf-8") as f:
67
  content = f.read()
68
 
 
69
  bpo_update = gr.Textbox(value=content)
70
  news_update = gr.Textbox(value=content)
71
  sentiment_update = gr.Textbox(value=content)
72
  except:
 
73
  pass
74
 
75
  except Exception as e:
 
89
  """
90
  Trasforma la lista [('testo', 'LABEL'), ('testo', None)] in HTML puro.
91
  """
92
+ # Mappa colori HEX
93
  colors = {
94
  "CODICE CLIENTE": "#3b82f6", # Blue 500
95
  "N. FATTURA": "#f97316", # Orange 500
style.css CHANGED
@@ -1,4 +1,4 @@
1
- /* --- 1. HEADER & LOGO --- */
2
  .header-row {
3
  display: flex !important;
4
  align-items: flex-end !important;
@@ -7,10 +7,13 @@
7
  padding-bottom: 20px;
8
  border-bottom: 1px solid #e2e8f0;
9
  }
 
10
  .h4-margin{
11
  margin-left: 4px 6px 6px 4px;
12
  }
 
13
  .logo-container img { margin-bottom: 4px !important; object-fit: contain; }
 
14
  .header-text-col h1 {
15
  font-family: 'Inter', sans-serif !important;
16
  font-weight: 900 !important;
@@ -24,12 +27,13 @@
24
  padding-bottom: 0 !important;
25
  line-height: 1.0 !important;
26
  }
 
27
  .header-text-col .subheader {
28
  text-align: left !important; color: #64748b; font-size: 1.1em; font-weight: 500;
29
  margin-top: 0 !important; padding-top: 0 !important;
30
  }
31
 
32
- /* --- 2. CUSTOM TABS STYLE (DESKTOP) --- */
33
  .tabs > .tab-nav { border-bottom: none !important; gap: 8px !important; margin-bottom: 15px !important; }
34
  .tabs > .tab-nav > button {
35
  border: 1px solid #e5e7eb !important; border-radius: 10px !important;
@@ -43,7 +47,7 @@
43
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3) !important;
44
  }
45
 
46
- /* --- 3. COMPONENTS --- */
47
  button.primary {
48
  background: linear-gradient(135deg, #8B5CF6 0%, #D65DB1 100%) !important;
49
  border: none !important; color: white !important; transition: filter 0.2s;
@@ -58,7 +62,7 @@ button.primary:hover { filter: brightness(1.1); box-shadow: 0 4px 15px rgba(139,
58
 
59
  .fixed-height-tab2 {height: 500px}
60
 
61
- /* Stile per la Model Card nel tab BPO */
62
  .model-card {
63
  background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 15px;
64
  font-size: 0.9em; color: #475569; margin-top: 10px;
@@ -68,18 +72,112 @@ button.primary:hover { filter: brightness(1.1); box-shadow: 0 4px 15px rgba(139,
68
  color: #475569 !important
69
  }
70
 
71
- /* --- 4. MOBILE RESPONSIVE --- */
72
  @media (max-width: 768px) {
73
- .header-row { flex-direction: column !important; align-items: center !important; text-align: center !important; gap: 10px !important; }
74
- .header-text-col h1 { text-align: center !important; font-size: 1.8em !important; }
75
- .header-text-col .subheader { text-align: center !important; }
76
- .responsive-row { flex-direction: column !important; display: flex !important; }
77
- .responsive-row > * { width: 100% !important; min-width: 100% !important; margin-bottom: 15px !important; }
78
 
79
- .tabs > .tab-nav { flex-wrap: wrap !important; justify-content: center !important; gap: 6px !important; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
  .tabs > .tab-nav > button {
81
- flex-grow: 1 !important; text-align: center !important; font-size: 0.85rem !important;
82
- padding: 8px 10px !important; margin: 0 !important; width: auto !important; min-width: 45% !important;
 
 
 
 
 
 
 
 
 
83
  }
 
 
 
 
 
 
84
  }
85
  footer {visibility: hidden}
 
1
+ /* --- HEADER & LOGO --- */
2
  .header-row {
3
  display: flex !important;
4
  align-items: flex-end !important;
 
7
  padding-bottom: 20px;
8
  border-bottom: 1px solid #e2e8f0;
9
  }
10
+
11
  .h4-margin{
12
  margin-left: 4px 6px 6px 4px;
13
  }
14
+
15
  .logo-container img { margin-bottom: 4px !important; object-fit: contain; }
16
+
17
  .header-text-col h1 {
18
  font-family: 'Inter', sans-serif !important;
19
  font-weight: 900 !important;
 
27
  padding-bottom: 0 !important;
28
  line-height: 1.0 !important;
29
  }
30
+
31
  .header-text-col .subheader {
32
  text-align: left !important; color: #64748b; font-size: 1.1em; font-weight: 500;
33
  margin-top: 0 !important; padding-top: 0 !important;
34
  }
35
 
36
+ /* --- CUSTOM TABS STYLE --- */
37
  .tabs > .tab-nav { border-bottom: none !important; gap: 8px !important; margin-bottom: 15px !important; }
38
  .tabs > .tab-nav > button {
39
  border: 1px solid #e5e7eb !important; border-radius: 10px !important;
 
47
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3) !important;
48
  }
49
 
50
+ /* --- COMPONENTS --- */
51
  button.primary {
52
  background: linear-gradient(135deg, #8B5CF6 0%, #D65DB1 100%) !important;
53
  border: none !important; color: white !important; transition: filter 0.2s;
 
62
 
63
  .fixed-height-tab2 {height: 500px}
64
 
65
+ /* Model Card tab BPO */
66
  .model-card {
67
  background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 15px;
68
  font-size: 0.9em; color: #475569; margin-top: 10px;
 
72
  color: #475569 !important
73
  }
74
 
75
+ /* --- MOBILE RESPONSIVE --- */
76
  @media (max-width: 768px) {
 
 
 
 
 
77
 
78
+ /* Gestione Contenitore Principale*/
79
+ .gradio-container {
80
+ padding-left: 15px !important;
81
+ padding-right: 15px !important;
82
+ max-width: 100% !important;
83
+ overflow-x: hidden !important;
84
+ }
85
+
86
+ /* Header più compatto e centrato */
87
+ .header-row {
88
+ flex-direction: row !important;
89
+ align-items: center !important;
90
+ justify-content: flex-start !important;
91
+ gap: 15px !important;
92
+ margin-bottom: 20px !important;
93
+ height: auto !important;
94
+ text-align: left !important;
95
+ padding-left: 5px !important;
96
+ padding-right: 5px !important;
97
+ }
98
+
99
+ .logo-container {
100
+ width: auto !important;
101
+ flex-shrink: 0 !important;
102
+ flex-grow: 0 !important;
103
+ margin: 0 !important;
104
+ padding: 0 !important;
105
+ display: flex !important;
106
+ align-items: center !important;
107
+ overflow: visible !important;
108
+ }
109
+
110
+ .logo-container img {
111
+ height: 60px !important;
112
+ width: auto !important;
113
+ margin-bottom: 0 !important;
114
+ object-fit: contain !important;
115
+ }
116
+
117
+ .header-text-col {
118
+ width: auto !important;
119
+ min-width: 0 !important;
120
+ flex-grow: 1 !important;
121
+ display: flex !important;
122
+ flex-direction: column !important;
123
+ justify-content: center !important;
124
+ }
125
+
126
+ .header-text-col h1 {
127
+ text-align: left !important;
128
+ font-size: 1.5em !important;
129
+ line-height: 1.2 !important;
130
+ margin-bottom: 2px !important;
131
+ white-space: normal !important;
132
+ word-wrap: break-word !important;
133
+ }
134
+
135
+ .header-text-col .subheader {
136
+ text-align: left !important;
137
+ font-size: 0.85rem !important;
138
+ margin-top: 0 !important;
139
+ line-height: 1.2 !important;
140
+ display: block !important;
141
+ }
142
+
143
+ /* Responsive Rows: Stack verticale pulito */
144
+ .responsive-row {
145
+ flex-direction: column !important;
146
+ display: flex !important;
147
+ gap: 20px !important;
148
+ }
149
+ .responsive-row > * {
150
+ width: 100% !important;
151
+ min-width: 0 !important;
152
+ margin: 0 !important;
153
+ padding: 0 !important;
154
+ }
155
+
156
+ /* Tab Navigation: Griglia 2x2 per i pulsanti */
157
+ .tabs > .tab-nav {
158
+ display: flex !important;
159
+ flex-wrap: wrap !important;
160
+ justify-content: center !important;
161
+ gap: 8px !important;
162
+ }
163
  .tabs > .tab-nav > button {
164
+ flex-grow: 1 !important;
165
+ text-align: center !important;
166
+ font-size: 0.85rem !important;
167
+ padding: 8px 4px !important;
168
+ width: 48% !important;
169
+ min-width: auto !important;
170
+ }
171
+
172
+ button {
173
+ min-height: 45px !important;
174
+ height: auto !important;
175
  }
176
+
177
+ .fixed-height {
178
+ height: auto !important;
179
+ min-height: 300px !important;
180
+ }
181
+
182
  }
183
  footer {visibility: hidden}