File size: 428 Bytes
34dad03
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import gradio as gr
import pandas as pd

def display_csv(file):
    # Read the CSV file
    df = pd.read_csv(file.name)
    # Return the DataFrame to Gradio for display
    return df

# Create a Gradio interface
interface = gr.Interface(
    fn=display_csv, 
    inputs="file", 
    outputs="dataframe",
    title="CSV Viewer",
    description="Upload a CSV file and view its contents."
)

# Run the interface
interface.launch()