Spaces:
Sleeping
Sleeping
import pandas as pd | |
import gradio as gr | |
from ydata_profiling import ProfileReport | |
def generate_profile(file): | |
# Load the uploaded file into a pandas dataframe | |
df = pd.read_csv(file.name) | |
# Generate the profile report | |
profile = ProfileReport(df, title="Pandas Profiling Report") | |
# Convert the profile report to a JSON format | |
profile_json = profile.to_json() | |
# Load the JSON into a pandas dataframe | |
profile_data = json.loads(profile_json) | |
df_profile = pd.json_normalize(profile_data) | |
return df_profile | |
# Create a Gradio interface | |
iface = gr.Interface( | |
fn=generate_profile, | |
#inputs=["text", "text", "text"], | |
inputs = ["file"], | |
outputs=["text"], | |
title="Agentville: Explore CSV files using autonomous agents", | |
description="Generate insights in minutes on your own data", | |
article="This Gradio app uses the CAMEL framework to initiate conversations across multiple autonomous agents for task-solving.", | |
live=False, | |
) | |
# Launch the Gradio app | |
if __name__ == "__main__": | |
iface.queue(max_size=20).launch(share=True,debug=True) |