Mandr1 commited on
Commit
3afd8ea
Β·
verified Β·
1 Parent(s): c15ef70

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +38 -12
app.py CHANGED
@@ -143,34 +143,60 @@ def analisis_gaji_final(judul, lokasi, model_choice):
143
  return f"<b>Error:</b> {e}", None
144
 
145
  # ------------------------------
146
- # CLEAN UI (NEW GRADIO FORMAT)
147
  # ------------------------------
148
 
149
- css = """
150
- .gradio-container {max-width: 1000px !important; margin:auto;}
 
 
 
 
 
 
 
 
151
  """
152
 
153
- with gr.Blocks(title="Salary AI", css=css) as demo:
 
 
 
154
 
155
- gr.Markdown("<h1 style='text-align:center;'>πŸ’Ό Salary AI</h1>")
156
- gr.Markdown("<p style='text-align:center; color:gray;'>Prediksi gaji dengan Machine Learning + Benchmark Indonesia.</p>")
 
 
 
 
157
 
158
  with gr.Row():
159
- with gr.Column():
160
- t1 = gr.Textbox(label="Posisi Pekerjaan")
161
- t2 = gr.Textbox(label="Kabupaten/Kota")
 
 
 
162
  model = gr.Dropdown(
163
  choices=list(loaded_models.keys()),
164
  value="Random Forest",
165
  label="Model Prediksi"
166
  )
167
- btn = gr.Button("πŸ” Analisis", variant="primary")
 
168
 
169
- with gr.Column():
 
 
170
  out_html = gr.HTML()
171
  out_plot = gr.Plot()
 
172
 
173
- btn.click(analisis_gaji_final, inputs=[t1, t2, model], outputs=[out_html, out_plot])
 
 
 
 
174
 
175
  if __name__ == "__main__":
176
  print("App running...")
 
143
  return f"<b>Error:</b> {e}", None
144
 
145
  # ------------------------------
146
+ # CLEAN UI (DASHBOARD STYLE) - FIXED
147
  # ------------------------------
148
 
149
+ custom_css = """
150
+ <style>
151
+ .dashboard-box {
152
+ background: #ffffff;
153
+ padding: 18px;
154
+ border-radius: 12px;
155
+ box-shadow: 0 2px 10px rgba(0,0,0,0.06);
156
+ }
157
+ .gradio-container {max-width: 1100px !important; margin:auto;}
158
+ </style>
159
  """
160
 
161
+ with gr.Blocks(title="Salary AI") as demo:
162
+
163
+ # Inject CSS
164
+ gr.HTML(custom_css)
165
 
166
+ gr.Markdown("""
167
+ <h1 style='text-align:center;'>πŸ’Ό Salary AI Dashboard</h1>
168
+ <p style='text-align:center; color:gray;'>
169
+ Prediksi gaji + Benchmark Nasional & Regional Indonesia.
170
+ </p>
171
+ """)
172
 
173
  with gr.Row():
174
+
175
+ # LEFT PANEL β€” INPUT FORM
176
+ with gr.Column(scale=1):
177
+ gr.HTML("<div class='dashboard-box'><h3>πŸ“₯ Input Data</h3>")
178
+ t1 = gr.Textbox(label="Posisi Pekerjaan", placeholder="cth: Data Analyst")
179
+ t2 = gr.Textbox(label="Kabupaten/Kota", placeholder="cth: Bandung")
180
  model = gr.Dropdown(
181
  choices=list(loaded_models.keys()),
182
  value="Random Forest",
183
  label="Model Prediksi"
184
  )
185
+ btn = gr.Button("πŸ” Analisis Gaji", variant="primary")
186
+ gr.HTML("</div>")
187
 
188
+ # RIGHT PANEL β€” OUTPUT
189
+ with gr.Column(scale=2):
190
+ gr.HTML("<div class='dashboard-box'><h3>πŸ“Š Hasil Analisis</h3>")
191
  out_html = gr.HTML()
192
  out_plot = gr.Plot()
193
+ gr.HTML("</div>")
194
 
195
+ btn.click(
196
+ analisis_gaji_final,
197
+ inputs=[t1, t2, model],
198
+ outputs=[out_html, out_plot]
199
+ )
200
 
201
  if __name__ == "__main__":
202
  print("App running...")