Spaces:
Runtime error
Runtime error
Commit Β·
950bce5
1
Parent(s): 1029010
Improve UI/UX - add custom CSS styling and better layout
Browse files219 unmodified lines2202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522 unmodified lines255256257258259260261262263264265266267268269270271272273274275276277278219 unmodified linesreturn f"β Error: {str(e)}", None, None, None, None, f"β Processing failed: {str(e)}"# Create Gradio interfacewith gr.Blocks(title="PromptPrepML", theme=gr.themes.Soft()) as demo:gr.Markdown("# π€ PromptPrepML")gr.Markdown("AI-Powered Machine Learning Data Preprocessing Assistant")gr.Markdown("Upload your dataset and get ML-ready results in seconds! π")with gr.Row():with gr.Column(scale=1):file_input = gr.File(label="π Upload CSV Dataset", file_types=[".csv"])prompt_input = gr.Textbox(label="π¬ Processing Instructions",value="Prepare this dataset for machine learning. Handle missing values, remove identifier columns, extract date features, encode categorical variables, and scale numeric features.",lines=3)process_btn = gr.Button("π Process Dataset", variant="primary")with gr.Column(scale=2):output_summary = gr.Markdown(label="π Results Summary")status_output = gr.Textbox(label="π Status", interactive=False)gr.Markdown("## π Preview of Processed Dataset")preview_output = gr.Dataframe(label="π Dataset Preview")gr.Markdown("## π₯ Download Files")with gr.Row():processed_download = gr.File(label="π Processed Dataset")train_download = gr.File(label="π Training Set")test_download = gr.File(label="π§ͺ Test Set")# Event handlersprocess_btn.click(2 unmodified linesoutputs=[output_summary, processed_download, train_download, test_download, preview_output, status_output])gr.Markdown("## π Instructions")gr.Markdown("""1. π **Upload your CSV dataset** (any size)2. π¬ **Describe your preprocessing needs** (or use default)3. π **Click "Process Dataset"**4. π₯ **Download your ML-ready results**5. π **Use for machine learning!**### π§ **Intelligent Features**- **Automatic identifier detection** and removal- **Smart date feature extraction**- **Text feature handling**- **Categorical encoding** for low-cardinality features- **High cardinality handling**- **Missing value imputation**- **Feature scaling**- **Train/test splitting**""")# Launch the appif __name__ == "__main__":219 unmodified lines2202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033042 unmodified lines307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340219 unmodified linesreturn f"β Error: {str(e)}", None, None, None, None, f"β Processing failed: {str(e)}"# Create Gradio interfacewith gr.Blocks(title="PromptPrepML", theme=gr.themes.Base(), css=""".gradio-container {max-width: 1200px !important;margin: auto !important;}.gr-button {background: linear-gradient(45deg, #667eea 0%, #764ba2 100%) !important;border: none !important;color: white !important;font-weight: bold !important;padding: 12px 24px !important;border-radius: 8px !important;transition: all 0.3s ease !important;}.gr-button:hover {transform: translateY(-2px) !important;box-shadow: 0 8px 25px rgba(0,0,0,0.15) !important;}.gr-file {border: 2px dashed #667eea !important;border-radius: 12px !important;background: #f8f9ff !important;transition: all 0.3s ease !important;}.gr-file:hover {border-color: #764ba2 !important;background: #f0f2ff !important;}.gr-textbox {border-radius: 8px !important;border: 1px solid #e1e5e9 !important;}.gr-textbox:focus {border-color: #667eea !important;box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1) !important;}.gr-markdown {text-align: center !important;}.gr-dataframe {border-radius: 8px !important;overflow: hidden !important;}""") as demo:gr.Markdown("# π€ PromptPrepML")gr.Markdown("**AI-Powered Machine Learning Data Preprocessing Assistant**")gr.Markdown("Upload your dataset and get ML-ready results in seconds! π")with gr.Row():with gr.Column(scale=1):gr.Markdown("### π Upload Dataset")file_input = gr.File(label="Choose CSV file", file_types=[".csv"])gr.Markdown("### π¬ Processing Instructions")prompt_input = gr.Textbox(label="Describe your needs",value="Prepare this dataset for machine learning. Handle missing values, remove identifier columns, extract date features, encode categorical variables, and scale numeric features.",lines=4)process_btn = gr.Button("π Process Dataset", variant="primary", size="lg")with gr.Column(scale=2):gr.Markdown("### π Results")output_summary = gr.Markdown(label="Processing Summary")status_output = gr.Textbox(label="π Status", interactive=False)gr.Markdown("---")gr.Markdown("### π Dataset Preview")preview_output = gr.Dataframe(label="First 10 rows of processed dataset")gr.Markdown("---")gr.Markdown("### π₯ Download Files")with gr.Row():with gr.Column():processed_download = gr.File(label="π Processed Dataset")with gr.Column():train_download = gr.File(label="π Training Set")with gr.Column():test_download = gr.File(label="π§ͺ Test Set")# Event handlersprocess_btn.click(2 unmodified linesoutputs=[output_summary, processed_download, train_download, test_download, preview_output, status_output])gr.Markdown("---")gr.Markdown("### π How to Use")with gr.Accordion("π Instructions", open=False):gr.Markdown("""1. **Upload your CSV dataset** (any size)2. **Describe your preprocessing needs** (or use default)3. **Click "Process Dataset"**4. **Download your ML-ready results**5. **Use for machine learning!**### π§ **Intelligent Features**- **Automatic identifier detection** and removal- **Smart date feature extraction**- **Text feature handling**- **Categorical encoding** for low-cardinality features- **High cardinality handling**- **Missing value imputation**- **Feature scaling**- **Train/test splitting**""")gr.Markdown("---")gr.Markdown("""<div style='text-align: center; color: #6b7280; margin-top: 2rem;'><p><strong>π€ PromptPrepML</strong> - Automated ML Data Preprocessing</p><p><small>Convert natural language prompts into ML-ready datasets</small></p></div>""", unsafe_allow_html=True)# Launch the appif __name__ == "__main__":
app.py+92-30