File size: 1,114 Bytes
43f57e8
f7dd29c
43f57e8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4bbc017
 
 
 
 
 
 
43f57e8
 
4bbc017
 
400c972
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
28
29
30
31
32
33
34
35
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)