Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -43,22 +43,56 @@ def convert_file(input_file, conversion_type):
|
|
| 43 |
)
|
| 44 |
return output_file, info_message
|
| 45 |
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
|
| 63 |
-
|
| 64 |
-
demo.launch()
|
|
|
|
| 43 |
)
|
| 44 |
return output_file, info_message
|
| 45 |
|
| 46 |
+
# Custom CSS for a modern and sleek look
|
| 47 |
+
custom_css = """
|
| 48 |
+
body {
|
| 49 |
+
background-color: #f4f4f4;
|
| 50 |
+
font-family: 'Helvetica Neue', Arial, sans-serif;
|
| 51 |
+
}
|
| 52 |
+
.gradio-container {
|
| 53 |
+
max-width: 900px;
|
| 54 |
+
margin: 40px auto;
|
| 55 |
+
padding: 20px;
|
| 56 |
+
background-color: #ffffff;
|
| 57 |
+
border-radius: 12px;
|
| 58 |
+
box-shadow: 0 8px 16px rgba(0,0,0,0.1);
|
| 59 |
+
}
|
| 60 |
+
h1, h2 {
|
| 61 |
+
color: #333333;
|
| 62 |
+
}
|
| 63 |
+
.gradio-input, .gradio-output {
|
| 64 |
+
margin-bottom: 20px;
|
| 65 |
+
}
|
| 66 |
+
.gradio-button {
|
| 67 |
+
background-color: #4CAF50 !important;
|
| 68 |
+
color: white !important;
|
| 69 |
+
border: none !important;
|
| 70 |
+
padding: 10px 20px !important;
|
| 71 |
+
font-size: 16px !important;
|
| 72 |
+
border-radius: 6px !important;
|
| 73 |
+
cursor: pointer;
|
| 74 |
+
}
|
| 75 |
+
.gradio-button:hover {
|
| 76 |
+
background-color: #45a049 !important;
|
| 77 |
+
}
|
| 78 |
+
"""
|
| 79 |
+
|
| 80 |
+
with gr.Blocks(css=custom_css, title="CSV <-> Parquet Converter") as demo:
|
| 81 |
+
gr.Markdown("# CSV <-> Parquet Converter")
|
| 82 |
+
gr.Markdown("Upload a CSV or Parquet file and select the conversion type. The app converts the file to the opposite format and displays a preview of the top 10 rows.")
|
| 83 |
+
|
| 84 |
+
with gr.Row():
|
| 85 |
+
with gr.Column(scale=1):
|
| 86 |
+
input_file = gr.File(label="Upload CSV or Parquet File")
|
| 87 |
+
with gr.Column(scale=1):
|
| 88 |
+
conversion_type = gr.Radio(choices=["CSV to Parquet", "Parquet to CSV"], label="Conversion Type")
|
| 89 |
+
|
| 90 |
+
convert_button = gr.Button("Convert", elem_classes=["gradio-button"])
|
| 91 |
+
|
| 92 |
+
with gr.Row():
|
| 93 |
+
output_file = gr.File(label="Converted File")
|
| 94 |
+
preview = gr.Textbox(label="Preview (Top 10 Rows)", lines=15)
|
| 95 |
+
|
| 96 |
+
convert_button.click(fn=convert_file, inputs=[input_file, conversion_type], outputs=[output_file, preview])
|
| 97 |
|
| 98 |
+
demo.launch()
|
|
|