Spaces:
No application file
No application file
| import streamlit as st | |
| import numpy as np | |
| def calcular_pendiente(ventas): | |
| x = np.arange(len(ventas)) | |
| y = np.array(ventas) | |
| if len(x) < 2: | |
| return "Datos insuficientes" | |
| pendiente = np.polyfit(x, y, 1)[0] | |
| return "Bien" if pendiente > 0 else "Mal" | |
| st.title("Evaluador de Crecimiento de Ventas") | |
| # Input: lista de ventas como texto separado por comas | |
| ventas_texto = st.text_input("Ingrese ventas separadas por comas", "100,120,130") | |
| try: | |
| # Convertir el texto en lista de floats | |
| lista_ventas = list(map(float, ventas_texto.split(","))) | |
| resultado = calcular_pendiente(lista_ventas) | |
| st.write(f"Crecimiento: {resultado}") | |
| except Exception: | |
| st.write("Error: Por favor ingrese números separados por comas correctamente.") | |