Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
#
|
| 150 |
-
# ------------------------------
|
| 151 |
|
| 152 |
custom_css = """
|
| 153 |
<style>
|
| 154 |
-
|
|
|
|
| 155 |
.gradio-container {
|
| 156 |
-
max-width:
|
| 157 |
margin: auto;
|
|
|
|
| 158 |
font-family: 'Inter', sans-serif;
|
| 159 |
}
|
| 160 |
|
| 161 |
-
/*
|
| 162 |
.dashboard-box {
|
| 163 |
-
background:
|
| 164 |
-
padding:
|
| 165 |
-
border-radius:
|
| 166 |
-
|
| 167 |
-
|
| 168 |
}
|
| 169 |
|
| 170 |
-
/*
|
| 171 |
h1 {
|
| 172 |
font-weight: 700;
|
| 173 |
-
|
|
|
|
| 174 |
}
|
| 175 |
h3 {
|
| 176 |
-
margin-bottom: 10px;
|
| 177 |
font-weight: 600;
|
|
|
|
| 178 |
}
|
| 179 |
|
| 180 |
-
/*
|
| 181 |
-
.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 182 |
font-size: 15px !important;
|
| 183 |
}
|
| 184 |
|
| 185 |
-
/*
|
| 186 |
-
|
| 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 |
-
/*
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 199 |
}
|
| 200 |
</style>
|
| 201 |
"""
|
| 202 |
|
| 203 |
-
with gr.Blocks(title="Salary AI"
|
| 204 |
|
|
|
|
| 205 |
# Inject CSS
|
|
|
|
| 206 |
gr.HTML(custom_css)
|
| 207 |
|
| 208 |
-
#
|
| 209 |
gr.Markdown("""
|
| 210 |
-
<h1 style='text-align:center;
|
| 211 |
-
<p style='text-align:center; color:#
|
| 212 |
-
Prediksi gaji
|
| 213 |
</p>
|
| 214 |
""")
|
| 215 |
|
| 216 |
with gr.Row():
|
| 217 |
|
| 218 |
-
# LEFT
|
| 219 |
-
with gr.Column(scale=1, min_width=
|
| 220 |
-
gr.HTML("<div class='dashboard-box'><h3>π₯ Input
|
| 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
|
| 232 |
with gr.Column(scale=2):
|
| 233 |
-
gr.HTML("<div class='dashboard-box'><h3>π Hasil
|
| 234 |
out_html = gr.HTML()
|
| 235 |
out_plot = gr.Plot()
|
| 236 |
gr.HTML("</div>")
|
| 237 |
|
| 238 |
-
#
|
| 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 |
-
|
| 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)
|
|
|