Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -146,37 +146,77 @@ import gradio as gr
|
|
| 146 |
# Pastikan Anda memiliki variabel loaded_models dan fungsi analisis_gaji_final yang terdefinisi
|
| 147 |
|
| 148 |
# ------------------------------
|
| 149 |
-
#
|
| 150 |
# ------------------------------
|
| 151 |
|
| 152 |
custom_css = """
|
| 153 |
<style>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 154 |
.dashboard-box {
|
| 155 |
background: #ffffff;
|
| 156 |
-
padding:
|
| 157 |
-
border-radius:
|
| 158 |
-
box-shadow: 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 159 |
}
|
| 160 |
-
.gradio-container {max-width: 1100px !important; margin:auto;}
|
| 161 |
</style>
|
| 162 |
"""
|
| 163 |
|
| 164 |
-
with gr.Blocks(title="Salary AI") as demo:
|
| 165 |
|
| 166 |
# Inject CSS
|
| 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:
|
| 172 |
-
Prediksi gaji
|
| 173 |
</p>
|
| 174 |
""")
|
| 175 |
|
| 176 |
with gr.Row():
|
| 177 |
|
| 178 |
# LEFT PANEL — INPUT FORM
|
| 179 |
-
with gr.Column(scale=1):
|
| 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")
|
|
@@ -195,6 +235,7 @@ with gr.Blocks(title="Salary AI") as demo:
|
|
| 195 |
out_plot = gr.Plot()
|
| 196 |
gr.HTML("</div>")
|
| 197 |
|
|
|
|
| 198 |
btn.click(
|
| 199 |
analisis_gaji_final,
|
| 200 |
inputs=[t1, t2, model],
|
|
@@ -203,4 +244,4 @@ with gr.Blocks(title="Salary AI") as demo:
|
|
| 203 |
|
| 204 |
if __name__ == "__main__":
|
| 205 |
print("App running...")
|
| 206 |
-
demo.launch(share=True, debug=True)
|
|
|
|
| 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")
|
|
|
|
| 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],
|
|
|
|
| 244 |
|
| 245 |
if __name__ == "__main__":
|
| 246 |
print("App running...")
|
| 247 |
+
demo.launch(share=True, debug=True)
|