Spaces:
Runtime error
Runtime error
import gradio as gr | |
import pandas as pd | |
def modify_csv(input_csv): | |
# Load the input CSV file into a pandas DataFrame | |
df = pd.read_csv(input_csv) | |
# Modify the DataFrame (in this example, just add 1 to all values) | |
df = df + 1 | |
# Save the modified DataFrame to a new CSV file | |
output_csv = 'output.csv' | |
df.to_csv(output_csv, index=False) | |
# Return the path to the output CSV file | |
return output_csv | |
# Define the input and output types for the Gradio interface | |
input_type = gr.inputs.Dataframe(type="csv", label="Upload a CSV file") | |
output_type = gr.outputs.File(type="csv", label="Download the modified CSV file") | |
# Create the Gradio interface | |
iface = gr.Interface(fn=modify_csv, inputs=input_type, outputs=output_type, title="CSV Modifier") | |
# Launch the interface | |
iface.launch() | |