Spaces:
Sleeping
Sleeping
import gradio as gr | |
import pandas as pd | |
import matplotlib.pyplot as plt | |
# Function to load a file and plot its contents as a DataFrame | |
def execute(file_path): | |
try: | |
# Load the file into a DataFrame | |
data = pd.read_csv(file_path) # You can change this to read_excel for Excel files | |
# Create a simple bar plot for demonstration | |
data.plot(kind='bar') | |
plt.xlabel("X-axis") | |
plt.ylabel("Y-axis") | |
plt.title("Data Visualization") | |
# Save the plot as an image | |
plot_image_path = 'plot.png' | |
plt.savefig(plot_image_path) | |
return f"Data loaded from {file_path}", plot_image_path | |
except Exception as e: | |
return str(e) | |
def load_inputs(): | |
gr.Text() | |
output_label = "Saídas" | |
title = 'Aba 2' | |
description = 'Carregar arquivo de pasta predefinida e visualizar' |