Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -146,7 +146,7 @@ import gradio as gr
|
|
| 146 |
# Pastikan Anda memiliki variabel loaded_models dan fungsi analisis_gaji_final yang terdefinisi
|
| 147 |
|
| 148 |
# ------------------------------
|
| 149 |
-
# CLEAN UI (DASHBOARD STYLE) -
|
| 150 |
# ------------------------------
|
| 151 |
|
| 152 |
custom_css = """
|
|
@@ -157,15 +157,7 @@ custom_css = """
|
|
| 157 |
border-radius: 12px;
|
| 158 |
box-shadow: 0 2px 10px rgba(0,0,0,0.06);
|
| 159 |
}
|
| 160 |
-
|
| 161 |
-
.gradio-container {
|
| 162 |
-
max-width: 1100px !important;
|
| 163 |
-
margin: 0 !important; /* Mengganti margin:auto dengan margin 0 (atau margin-left: 0;) */
|
| 164 |
-
}
|
| 165 |
-
/* Memastikan body Gradio juga rata kiri */
|
| 166 |
-
body {
|
| 167 |
-
align-items: flex-start;
|
| 168 |
-
}
|
| 169 |
</style>
|
| 170 |
"""
|
| 171 |
|
|
@@ -175,8 +167,8 @@ with gr.Blocks(title="Salary AI") as demo:
|
|
| 175 |
gr.HTML(custom_css)
|
| 176 |
|
| 177 |
gr.Markdown("""
|
| 178 |
-
<h1 style='text-align:
|
| 179 |
-
<p style='text-align:
|
| 180 |
Prediksi gaji + Benchmark Nasional & Regional Indonesia.
|
| 181 |
</p>
|
| 182 |
""")
|
|
@@ -188,23 +180,11 @@ with gr.Blocks(title="Salary AI") as demo:
|
|
| 188 |
gr.HTML("<div class='dashboard-box'><h3>📥 Input Data</h3>")
|
| 189 |
t1 = gr.Textbox(label="Posisi Pekerjaan", placeholder="cth: Data Analyst")
|
| 190 |
t2 = gr.Textbox(label="Kabupaten/Kota", placeholder="cth: Bandung")
|
| 191 |
-
|
| 192 |
-
# --- Bagian ini membutuhkan definisi 'loaded_models' ---
|
| 193 |
-
# Jika 'loaded_models' belum didefinisikan, gunakan choices sementara
|
| 194 |
-
# Contoh: choices=["Random Forest", "Linear Regression"]
|
| 195 |
-
# model = gr.Dropdown(
|
| 196 |
-
# choices=list(loaded_models.keys()),
|
| 197 |
-
# value="Random Forest",
|
| 198 |
-
# label="Model Prediksi"
|
| 199 |
-
# )
|
| 200 |
-
|
| 201 |
-
# Menggunakan contoh choices agar kode dapat dijalankan
|
| 202 |
model = gr.Dropdown(
|
| 203 |
-
choices=
|
| 204 |
value="Random Forest",
|
| 205 |
label="Model Prediksi"
|
| 206 |
)
|
| 207 |
-
|
| 208 |
btn = gr.Button("🔍 Analisis Gaji", variant="primary")
|
| 209 |
gr.HTML("</div>")
|
| 210 |
|
|
@@ -215,14 +195,12 @@ with gr.Blocks(title="Salary AI") as demo:
|
|
| 215 |
out_plot = gr.Plot()
|
| 216 |
gr.HTML("</div>")
|
| 217 |
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
# )
|
| 224 |
|
| 225 |
if __name__ == "__main__":
|
| 226 |
print("App running...")
|
| 227 |
-
# PASTIKAN INI TIDAK DIKOMENTARI
|
| 228 |
demo.launch(share=True, debug=True)
|
|
|
|
| 146 |
# Pastikan Anda memiliki variabel loaded_models dan fungsi analisis_gaji_final yang terdefinisi
|
| 147 |
|
| 148 |
# ------------------------------
|
| 149 |
+
# CLEAN UI (DASHBOARD STYLE) - FIXED
|
| 150 |
# ------------------------------
|
| 151 |
|
| 152 |
custom_css = """
|
|
|
|
| 157 |
border-radius: 12px;
|
| 158 |
box-shadow: 0 2px 10px rgba(0,0,0,0.06);
|
| 159 |
}
|
| 160 |
+
.gradio-container {max-width: 1100px !important; margin:auto;}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 161 |
</style>
|
| 162 |
"""
|
| 163 |
|
|
|
|
| 167 |
gr.HTML(custom_css)
|
| 168 |
|
| 169 |
gr.Markdown("""
|
| 170 |
+
<h1 style='text-align:center;'>💼 Salary AI Dashboard</h1>
|
| 171 |
+
<p style='text-align:center; color:gray;'>
|
| 172 |
Prediksi gaji + Benchmark Nasional & Regional Indonesia.
|
| 173 |
</p>
|
| 174 |
""")
|
|
|
|
| 180 |
gr.HTML("<div class='dashboard-box'><h3>📥 Input Data</h3>")
|
| 181 |
t1 = gr.Textbox(label="Posisi Pekerjaan", placeholder="cth: Data Analyst")
|
| 182 |
t2 = gr.Textbox(label="Kabupaten/Kota", placeholder="cth: Bandung")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 183 |
model = gr.Dropdown(
|
| 184 |
+
choices=list(loaded_models.keys()),
|
| 185 |
value="Random Forest",
|
| 186 |
label="Model Prediksi"
|
| 187 |
)
|
|
|
|
| 188 |
btn = gr.Button("🔍 Analisis Gaji", variant="primary")
|
| 189 |
gr.HTML("</div>")
|
| 190 |
|
|
|
|
| 195 |
out_plot = gr.Plot()
|
| 196 |
gr.HTML("</div>")
|
| 197 |
|
| 198 |
+
btn.click(
|
| 199 |
+
analisis_gaji_final,
|
| 200 |
+
inputs=[t1, t2, model],
|
| 201 |
+
outputs=[out_html, out_plot]
|
| 202 |
+
)
|
|
|
|
| 203 |
|
| 204 |
if __name__ == "__main__":
|
| 205 |
print("App running...")
|
|
|
|
| 206 |
demo.launch(share=True, debug=True)
|