openfree commited on
Commit
31c7995
·
verified ·
1 Parent(s): 1171fc8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +52 -18
app.py CHANGED
@@ -43,22 +43,56 @@ def convert_file(input_file, conversion_type):
43
  )
44
  return output_file, info_message
45
 
46
- demo = gr.Interface(
47
- fn=convert_file,
48
- inputs=[
49
- gr.File(label="Upload CSV or Parquet File"),
50
- gr.Radio(choices=["CSV to Parquet", "Parquet to CSV"], label="Conversion Type")
51
- ],
52
- outputs=[
53
- gr.File(label="Converted File"),
54
- gr.Textbox(label="Preview (Top 10 Rows)", lines=15)
55
- ],
56
- title="CSV <-> Parquet Converter",
57
- description=(
58
- "Upload a CSV or Parquet file and select the conversion type. "
59
- "The app converts the file to the opposite format and displays a preview of the top 10 rows."
60
- )
61
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
 
63
- if __name__ == "__main__":
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()