Spaces:
Runtime error
Runtime error
File size: 816 Bytes
fa0686b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
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()
|