Spaces:
Running
Running
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() |