Mandr1 commited on
Commit
499d403
Β·
verified Β·
1 Parent(s): a747952

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +48 -40
app.py CHANGED
@@ -145,79 +145,88 @@ def analisis_gaji_final(judul, lokasi, model_choice):
145
  import gradio as gr
146
  # Pastikan Anda memiliki variabel loaded_models dan fungsi analisis_gaji_final yang terdefinisi
147
 
148
- # ------------------------------
149
- # DASHBOARD UI
150
- # ------------------------------
151
 
152
  custom_css = """
153
  <style>
154
- /* GLOBAL */
 
155
  .gradio-container {
156
- max-width: 1250px !important;
157
  margin: auto;
 
158
  font-family: 'Inter', sans-serif;
159
  }
160
 
161
- /* CARD CONTAINER */
162
  .dashboard-box {
163
- background: #ffffff;
164
- padding: 22px;
165
- border-radius: 14px;
166
- box-shadow: 0 4px 18px rgba(0,0,0,0.05);
167
- border: 1px solid #f1f1f1;
168
  }
169
 
170
- /* HEADERS */
171
  h1 {
172
  font-weight: 700;
173
- letter-spacing: -0.5px;
 
174
  }
175
  h3 {
176
- margin-bottom: 10px;
177
  font-weight: 600;
 
178
  }
179
 
180
- /* INPUT ELEMENTS */
181
- .gradio-input, .gradio-dropdown, .gradio-textbox {
 
 
 
 
182
  font-size: 15px !important;
183
  }
184
 
185
- /* BUTTON */
186
- button.primary {
187
- background: linear-gradient(135deg, #005bea, #00c6fb) !important;
188
- color: white !important;
189
  border-radius: 8px !important;
190
- padding: 12px !important;
191
- font-size: 16px !important;
192
  }
193
 
194
- /* Dashboard Grid Adjust */
195
- @media (min-width: 1000px) {
196
- .gr-row {
197
- gap: 20px;
198
- }
 
 
 
 
199
  }
200
  </style>
201
  """
202
 
203
- with gr.Blocks(title="Salary AI", theme=gr.themes.Soft()) as demo:
204
 
 
205
  # Inject CSS
 
206
  gr.HTML(custom_css)
207
 
208
- # HEADER
209
  gr.Markdown("""
210
- <h1 style='text-align:center; margin-bottom:4px;'>πŸ’Ό Salary AI Dashboard</h1>
211
- <p style='text-align:center; color:#666; font-size:16px;'>
212
- Prediksi gaji berdasarkan benchmark Nasional & Regional Indonesia.
213
  </p>
214
  """)
215
 
216
  with gr.Row():
217
 
218
- # LEFT PANEL β€” INPUT FORM
219
- with gr.Column(scale=1, min_width=380):
220
- gr.HTML("<div class='dashboard-box'><h3>πŸ“₯ Input Data</h3>")
221
  t1 = gr.Textbox(label="Posisi Pekerjaan", placeholder="cth: Data Analyst")
222
  t2 = gr.Textbox(label="Kabupaten/Kota", placeholder="cth: Bandung")
223
  model = gr.Dropdown(
@@ -228,14 +237,14 @@ with gr.Blocks(title="Salary AI", theme=gr.themes.Soft()) as demo:
228
  btn = gr.Button("πŸ” Analisis Gaji", variant="primary")
229
  gr.HTML("</div>")
230
 
231
- # RIGHT PANEL β€” OUTPUT
232
  with gr.Column(scale=2):
233
- gr.HTML("<div class='dashboard-box'><h3>πŸ“Š Hasil Analisis</h3>")
234
  out_html = gr.HTML()
235
  out_plot = gr.Plot()
236
  gr.HTML("</div>")
237
 
238
- # RUN CALLBACK
239
  btn.click(
240
  analisis_gaji_final,
241
  inputs=[t1, t2, model],
@@ -243,5 +252,4 @@ with gr.Blocks(title="Salary AI", theme=gr.themes.Soft()) as demo:
243
  )
244
 
245
  if __name__ == "__main__":
246
- print("App running...")
247
- demo.launch(share=True, debug=True)
 
145
  import gradio as gr
146
  # Pastikan Anda memiliki variabel loaded_models dan fungsi analisis_gaji_final yang terdefinisi
147
 
148
+ # -------------------------------------------
149
+ # ENHANCED DEFAULT GRADIO UI (CLEAN & MODERN)
150
+ # -------------------------------------------
151
 
152
  custom_css = """
153
  <style>
154
+
155
+ /* Maintain original Gradio feel */
156
  .gradio-container {
157
+ max-width: 1150px !important;
158
  margin: auto;
159
+ padding-top: 20px;
160
  font-family: 'Inter', sans-serif;
161
  }
162
 
163
+ /* Subtle card styling */
164
  .dashboard-box {
165
+ background: white;
166
+ padding: 18px 20px;
167
+ border-radius: 12px;
168
+ border: 1px solid #e5e7eb;
169
+ box-shadow: 0px 1px 4px rgba(0,0,0,0.05);
170
  }
171
 
172
+ /* Header */
173
  h1 {
174
  font-weight: 700;
175
+ margin-bottom: 6px;
176
+ font-size: 32px;
177
  }
178
  h3 {
 
179
  font-weight: 600;
180
+ margin-bottom: 12px;
181
  }
182
 
183
+ /* Buttons β€” keep default look but nicer */
184
+ button.primary {
185
+ background: #3b82f6 !important; /* Gradio blue, enhanced */
186
+ color: white !important;
187
+ border-radius: 8px !important;
188
+ padding: 10px 14px !important;
189
  font-size: 15px !important;
190
  }
191
 
192
+ /* Inputs enhance */
193
+ input, textarea, select, .gr-text-input {
 
 
194
  border-radius: 8px !important;
 
 
195
  }
196
 
197
+ /* Row spacing */
198
+ .gr-row {
199
+ gap: 16px !important;
200
+ }
201
+
202
+ /* Responsiveness */
203
+ @media (max-width: 768px) {
204
+ .gradio-container {max-width: 95% !important;}
205
+ h1 {font-size: 26px;}
206
  }
207
  </style>
208
  """
209
 
210
+ with gr.Blocks(title="Salary AI") as demo:
211
 
212
+ # -------------------------------------------
213
  # Inject CSS
214
+ # -------------------------------------------
215
  gr.HTML(custom_css)
216
 
217
+ # Header
218
  gr.Markdown("""
219
+ <h1 style='text-align:center;'>πŸ’Ό Salary AI Dashboard</h1>
220
+ <p style='text-align:center; color:#555; font-size:15px;'>
221
+ Prediksi gaji dengan tampilan simple & elegan ala Gradio.
222
  </p>
223
  """)
224
 
225
  with gr.Row():
226
 
227
+ # LEFT β€” Input Form
228
+ with gr.Column(scale=1, min_width=360):
229
+ gr.HTML("<div class='dashboard-box'><h3>πŸ“₯ Input</h3>")
230
  t1 = gr.Textbox(label="Posisi Pekerjaan", placeholder="cth: Data Analyst")
231
  t2 = gr.Textbox(label="Kabupaten/Kota", placeholder="cth: Bandung")
232
  model = gr.Dropdown(
 
237
  btn = gr.Button("πŸ” Analisis Gaji", variant="primary")
238
  gr.HTML("</div>")
239
 
240
+ # RIGHT β€” Output
241
  with gr.Column(scale=2):
242
+ gr.HTML("<div class='dashboard-box'><h3>πŸ“Š Hasil</h3>")
243
  out_html = gr.HTML()
244
  out_plot = gr.Plot()
245
  gr.HTML("</div>")
246
 
247
+ # Button Function
248
  btn.click(
249
  analisis_gaji_final,
250
  inputs=[t1, t2, model],
 
252
  )
253
 
254
  if __name__ == "__main__":
255
+ demo.launch(share=True)