Update app.py
Browse files
app.py
CHANGED
|
@@ -8,18 +8,20 @@ global_df = None
|
|
| 8 |
def process_csv(file):
|
| 9 |
global global_df
|
| 10 |
if file is None:
|
| 11 |
-
return
|
| 12 |
|
| 13 |
# Read the CSV file into a DataFrame and store it in the global variable
|
| 14 |
global_df = pd.read_csv(StringIO(file.decode("utf-8")))
|
|
|
|
| 15 |
|
| 16 |
# Create the Gradio interface
|
| 17 |
iface = gr.Interface(
|
| 18 |
fn=process_csv,
|
| 19 |
inputs=gr.File(type="binary", label="Upload CSV File"),
|
|
|
|
| 20 |
title="CSV File Upload",
|
| 21 |
description="Upload a CSV file to load it into a pandas DataFrame."
|
| 22 |
)
|
| 23 |
|
| 24 |
if __name__ == "__main__":
|
| 25 |
-
iface.launch()
|
|
|
|
| 8 |
def process_csv(file):
|
| 9 |
global global_df
|
| 10 |
if file is None:
|
| 11 |
+
return None
|
| 12 |
|
| 13 |
# Read the CSV file into a DataFrame and store it in the global variable
|
| 14 |
global_df = pd.read_csv(StringIO(file.decode("utf-8")))
|
| 15 |
+
return None # Return None as we don't want to show any output
|
| 16 |
|
| 17 |
# Create the Gradio interface
|
| 18 |
iface = gr.Interface(
|
| 19 |
fn=process_csv,
|
| 20 |
inputs=gr.File(type="binary", label="Upload CSV File"),
|
| 21 |
+
outputs=gr.components.Label(), # Use Label as a placeholder output
|
| 22 |
title="CSV File Upload",
|
| 23 |
description="Upload a CSV file to load it into a pandas DataFrame."
|
| 24 |
)
|
| 25 |
|
| 26 |
if __name__ == "__main__":
|
| 27 |
+
iface.launch()
|