Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,16 @@
|
|
| 1 |
-
import gradio as gr
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import pandas as pd
|
| 3 |
+
import io
|
| 4 |
|
| 5 |
+
def read_csv(csv_file):
|
| 6 |
+
# Convert uploaded file data to pandas DataFrame
|
| 7 |
+
content = csv_file.getvalue().decode('utf-8')
|
| 8 |
+
df = pd.read_csv(io.StringIO(content))
|
| 9 |
+
return df
|
| 10 |
|
| 11 |
+
iface = gr.Interface(fn=read_csv,
|
| 12 |
+
inputs=gr.File(label="Upload CSV file"),
|
| 13 |
+
outputs="dataframe",
|
| 14 |
+
title="CSV File Reader",
|
| 15 |
+
description="Upload a CSV file and read its contents.")
|
| 16 |
+
iface.launch(debug=True)
|