vivek9 commited on
Commit
57b138a
·
verified ·
1 Parent(s): c386cc2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -4
app.py CHANGED
@@ -1,6 +1,16 @@
1
- import gradio as gr
 
 
2
 
3
- with gr.Blocks() as demo:
4
- gr.File()
 
 
 
5
 
6
- demo.launch()
 
 
 
 
 
 
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)