tab1_to_tab2 / tab2.py
fschwartzer's picture
Update tab2.py
8018ce1
raw
history blame contribute delete
853 Bytes
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'