Learnerbegginer commited on
Commit
950bce5
Β·
1 Parent(s): 1029010

Improve UI/UX - add custom CSS styling and better layout

Browse files
Files changed (1) hide show
  1. app.py +92 -30
app.py CHANGED
@@ -220,33 +220,85 @@ def process_dataset(file, prompt):
220
  return f"❌ Error: {str(e)}", None, None, None, None, f"❌ Processing failed: {str(e)}"
221
 
222
  # Create Gradio interface
223
- with gr.Blocks(title="PromptPrepML", theme=gr.themes.Soft()) as demo:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
224
  gr.Markdown("# πŸ€– PromptPrepML")
225
- gr.Markdown("AI-Powered Machine Learning Data Preprocessing Assistant")
226
  gr.Markdown("Upload your dataset and get ML-ready results in seconds! πŸš€")
227
 
228
  with gr.Row():
229
  with gr.Column(scale=1):
230
- file_input = gr.File(label="πŸ“ Upload CSV Dataset", file_types=[".csv"])
 
 
 
231
  prompt_input = gr.Textbox(
232
- label="πŸ’¬ Processing Instructions",
233
  value="Prepare this dataset for machine learning. Handle missing values, remove identifier columns, extract date features, encode categorical variables, and scale numeric features.",
234
- lines=3
235
  )
236
- process_btn = gr.Button("πŸš€ Process Dataset", variant="primary")
237
 
238
  with gr.Column(scale=2):
239
- output_summary = gr.Markdown(label="πŸ“Š Results Summary")
 
240
  status_output = gr.Textbox(label="πŸ”” Status", interactive=False)
241
 
242
- gr.Markdown("## πŸ“‹ Preview of Processed Dataset")
243
- preview_output = gr.Dataframe(label="πŸ‘€ Dataset Preview")
 
244
 
245
- gr.Markdown("## πŸ“₯ Download Files")
 
246
  with gr.Row():
247
- processed_download = gr.File(label="πŸ“Š Processed Dataset")
248
- train_download = gr.File(label="πŸš‚ Training Set")
249
- test_download = gr.File(label="πŸ§ͺ Test Set")
 
 
 
250
 
251
  # Event handlers
252
  process_btn.click(
@@ -255,24 +307,34 @@ with gr.Blocks(title="PromptPrepML", theme=gr.themes.Soft()) as demo:
255
  outputs=[output_summary, processed_download, train_download, test_download, preview_output, status_output]
256
  )
257
 
258
- gr.Markdown("## πŸ“š Instructions")
259
- gr.Markdown("""
260
- 1. πŸ“ **Upload your CSV dataset** (any size)
261
- 2. πŸ’¬ **Describe your preprocessing needs** (or use default)
262
- 3. πŸš€ **Click "Process Dataset"**
263
- 4. πŸ“₯ **Download your ML-ready results**
264
- 5. πŸŽ‰ **Use for machine learning!**
 
 
 
 
 
 
 
 
 
 
 
 
 
265
 
266
- ### 🧠 **Intelligent Features**
267
- - **Automatic identifier detection** and removal
268
- - **Smart date feature extraction**
269
- - **Text feature handling**
270
- - **Categorical encoding** for low-cardinality features
271
- - **High cardinality handling**
272
- - **Missing value imputation**
273
- - **Feature scaling**
274
- - **Train/test splitting**
275
- """)
276
 
277
  # Launch the app
278
  if __name__ == "__main__":
 
220
  return f"❌ Error: {str(e)}", None, None, None, None, f"❌ Processing failed: {str(e)}"
221
 
222
  # Create Gradio interface
223
+ with gr.Blocks(title="PromptPrepML", theme=gr.themes.Base(), css="""
224
+ .gradio-container {
225
+ max-width: 1200px !important;
226
+ margin: auto !important;
227
+ }
228
+ .gr-button {
229
+ background: linear-gradient(45deg, #667eea 0%, #764ba2 100%) !important;
230
+ border: none !important;
231
+ color: white !important;
232
+ font-weight: bold !important;
233
+ padding: 12px 24px !important;
234
+ border-radius: 8px !important;
235
+ transition: all 0.3s ease !important;
236
+ }
237
+ .gr-button:hover {
238
+ transform: translateY(-2px) !important;
239
+ box-shadow: 0 8px 25px rgba(0,0,0,0.15) !important;
240
+ }
241
+ .gr-file {
242
+ border: 2px dashed #667eea !important;
243
+ border-radius: 12px !important;
244
+ background: #f8f9ff !important;
245
+ transition: all 0.3s ease !important;
246
+ }
247
+ .gr-file:hover {
248
+ border-color: #764ba2 !important;
249
+ background: #f0f2ff !important;
250
+ }
251
+ .gr-textbox {
252
+ border-radius: 8px !important;
253
+ border: 1px solid #e1e5e9 !important;
254
+ }
255
+ .gr-textbox:focus {
256
+ border-color: #667eea !important;
257
+ box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1) !important;
258
+ }
259
+ .gr-markdown {
260
+ text-align: center !important;
261
+ }
262
+ .gr-dataframe {
263
+ border-radius: 8px !important;
264
+ overflow: hidden !important;
265
+ }
266
+ """) as demo:
267
  gr.Markdown("# πŸ€– PromptPrepML")
268
+ gr.Markdown("**AI-Powered Machine Learning Data Preprocessing Assistant**")
269
  gr.Markdown("Upload your dataset and get ML-ready results in seconds! πŸš€")
270
 
271
  with gr.Row():
272
  with gr.Column(scale=1):
273
+ gr.Markdown("### πŸ“ Upload Dataset")
274
+ file_input = gr.File(label="Choose CSV file", file_types=[".csv"])
275
+
276
+ gr.Markdown("### πŸ’¬ Processing Instructions")
277
  prompt_input = gr.Textbox(
278
+ label="Describe your needs",
279
  value="Prepare this dataset for machine learning. Handle missing values, remove identifier columns, extract date features, encode categorical variables, and scale numeric features.",
280
+ lines=4
281
  )
282
+ process_btn = gr.Button("πŸš€ Process Dataset", variant="primary", size="lg")
283
 
284
  with gr.Column(scale=2):
285
+ gr.Markdown("### πŸ“Š Results")
286
+ output_summary = gr.Markdown(label="Processing Summary")
287
  status_output = gr.Textbox(label="πŸ”” Status", interactive=False)
288
 
289
+ gr.Markdown("---")
290
+ gr.Markdown("### πŸ“‹ Dataset Preview")
291
+ preview_output = gr.Dataframe(label="First 10 rows of processed dataset")
292
 
293
+ gr.Markdown("---")
294
+ gr.Markdown("### πŸ“₯ Download Files")
295
  with gr.Row():
296
+ with gr.Column():
297
+ processed_download = gr.File(label="πŸ“Š Processed Dataset")
298
+ with gr.Column():
299
+ train_download = gr.File(label="πŸš‚ Training Set")
300
+ with gr.Column():
301
+ test_download = gr.File(label="πŸ§ͺ Test Set")
302
 
303
  # Event handlers
304
  process_btn.click(
 
307
  outputs=[output_summary, processed_download, train_download, test_download, preview_output, status_output]
308
  )
309
 
310
+ gr.Markdown("---")
311
+ gr.Markdown("### πŸ“š How to Use")
312
+ with gr.Accordion("πŸ“– Instructions", open=False):
313
+ gr.Markdown("""
314
+ 1. **Upload your CSV dataset** (any size)
315
+ 2. **Describe your preprocessing needs** (or use default)
316
+ 3. **Click "Process Dataset"**
317
+ 4. **Download your ML-ready results**
318
+ 5. **Use for machine learning!**
319
+
320
+ ### 🧠 **Intelligent Features**
321
+ - **Automatic identifier detection** and removal
322
+ - **Smart date feature extraction**
323
+ - **Text feature handling**
324
+ - **Categorical encoding** for low-cardinality features
325
+ - **High cardinality handling**
326
+ - **Missing value imputation**
327
+ - **Feature scaling**
328
+ - **Train/test splitting**
329
+ """)
330
 
331
+ gr.Markdown("---")
332
+ gr.Markdown("""
333
+ <div style='text-align: center; color: #6b7280; margin-top: 2rem;'>
334
+ <p><strong>πŸ€– PromptPrepML</strong> - Automated ML Data Preprocessing</p>
335
+ <p><small>Convert natural language prompts into ML-ready datasets</small></p>
336
+ </div>
337
+ """, unsafe_allow_html=True)
 
 
 
338
 
339
  # Launch the app
340
  if __name__ == "__main__":