Commit
·
5c9676b
1
Parent(s):
a8dfe81
Guardar mis cambios locales
Browse files- app.py +21 -35
- styles.css +15 -0
app.py
CHANGED
|
@@ -10,60 +10,46 @@ from pmdarima import auto_arima
|
|
| 10 |
|
| 11 |
# Preprocessing functions (same as before)
|
| 12 |
def merge(B, C, A):
|
| 13 |
-
# Implement merge function here...
|
| 14 |
-
pass
|
| 15 |
|
| 16 |
def merge_sort(dataframe):
|
| 17 |
-
# Implement merge_sort function here...
|
| 18 |
-
pass
|
| 19 |
|
| 20 |
def drop(dataframe):
|
| 21 |
-
# Implement drop function here...
|
| 22 |
-
pass
|
| 23 |
|
| 24 |
def date_format(dataframe):
|
| 25 |
-
# Implement date_format function here...
|
| 26 |
-
pass
|
| 27 |
|
| 28 |
def group_to_three(dataframe):
|
| 29 |
-
# Implement group_to_three function here...
|
| 30 |
-
pass
|
| 31 |
|
| 32 |
def series_to_df_exogenous(series):
|
| 33 |
-
# Implement series_to_df_exogenous function here...
|
| 34 |
-
pass
|
| 35 |
|
| 36 |
def dates_df(dataframe):
|
| 37 |
-
# Implement dates_df function here...
|
| 38 |
-
pass
|
| 39 |
|
| 40 |
def get_forecast_period(period):
|
| 41 |
-
# Implement get_forecast_period function here...
|
| 42 |
-
pass
|
| 43 |
|
| 44 |
def train_test(dataframe, n):
|
| 45 |
-
# Implement train_test function here...
|
| 46 |
-
pass
|
| 47 |
|
| 48 |
def test_fitting(dataframe, Exo, trainY):
|
| 49 |
-
# Implement test_fitting function here...
|
| 50 |
-
pass
|
| 51 |
|
| 52 |
def forecast_accuracy(forecast, actual):
|
| 53 |
-
# Implement forecast_accuracy function here...
|
| 54 |
-
pass
|
| 55 |
|
| 56 |
def sales_growth(dataframe, fittedValues):
|
| 57 |
-
# Implement sales_growth function here...
|
| 58 |
-
pass
|
| 59 |
|
| 60 |
def merge_forecast_data(actual, predicted, future):
|
| 61 |
-
# Implement merge_forecast_data function here...
|
| 62 |
-
pass
|
| 63 |
|
| 64 |
def interpret_mape(mape_score):
|
| 65 |
-
# Implement interpret_mape function here...
|
| 66 |
-
pass
|
| 67 |
|
| 68 |
def load_tapas_model():
|
| 69 |
model_name = "google/tapas-large-finetuned-wtq"
|
|
@@ -79,12 +65,10 @@ def get_answer(table, query):
|
|
| 79 |
return answers
|
| 80 |
|
| 81 |
def convert_answer(answer):
|
| 82 |
-
# Implement convert_answer function here...
|
| 83 |
-
pass
|
| 84 |
|
| 85 |
def get_converted_answer(table, query):
|
| 86 |
-
# Implement get_converted_answer function here...
|
| 87 |
-
pass
|
| 88 |
|
| 89 |
# Gradio Interface with emojis and colors
|
| 90 |
def upload_and_forecast(uploaded_file, period):
|
|
@@ -138,7 +122,7 @@ def upload_and_forecast(uploaded_file, period):
|
|
| 138 |
# Return the figures and growth data
|
| 139 |
return fig_compare, fig_forecast, future_sales_growth
|
| 140 |
|
| 141 |
-
# Gradio Interface setup with
|
| 142 |
iface = gr.Interface(
|
| 143 |
fn=upload_and_forecast,
|
| 144 |
inputs=[
|
|
@@ -152,8 +136,10 @@ iface = gr.Interface(
|
|
| 152 |
],
|
| 153 |
live=True,
|
| 154 |
theme="compact",
|
| 155 |
-
title="Sales Forecasting System ✨
|
| 156 |
-
description="Upload your sales data to start forecasting 🚀"
|
|
|
|
|
|
|
| 157 |
)
|
| 158 |
|
| 159 |
iface.launch()
|
|
|
|
| 10 |
|
| 11 |
# Preprocessing functions (same as before)
|
| 12 |
def merge(B, C, A):
|
| 13 |
+
pass # Implement merge function here...
|
|
|
|
| 14 |
|
| 15 |
def merge_sort(dataframe):
|
| 16 |
+
pass # Implement merge_sort function here...
|
|
|
|
| 17 |
|
| 18 |
def drop(dataframe):
|
| 19 |
+
pass # Implement drop function here...
|
|
|
|
| 20 |
|
| 21 |
def date_format(dataframe):
|
| 22 |
+
pass # Implement date_format function here...
|
|
|
|
| 23 |
|
| 24 |
def group_to_three(dataframe):
|
| 25 |
+
pass # Implement group_to_three function here...
|
|
|
|
| 26 |
|
| 27 |
def series_to_df_exogenous(series):
|
| 28 |
+
pass # Implement series_to_df_exogenous function here...
|
|
|
|
| 29 |
|
| 30 |
def dates_df(dataframe):
|
| 31 |
+
pass # Implement dates_df function here...
|
|
|
|
| 32 |
|
| 33 |
def get_forecast_period(period):
|
| 34 |
+
pass # Implement get_forecast_period function here...
|
|
|
|
| 35 |
|
| 36 |
def train_test(dataframe, n):
|
| 37 |
+
pass # Implement train_test function here...
|
|
|
|
| 38 |
|
| 39 |
def test_fitting(dataframe, Exo, trainY):
|
| 40 |
+
pass # Implement test_fitting function here...
|
|
|
|
| 41 |
|
| 42 |
def forecast_accuracy(forecast, actual):
|
| 43 |
+
pass # Implement forecast_accuracy function here...
|
|
|
|
| 44 |
|
| 45 |
def sales_growth(dataframe, fittedValues):
|
| 46 |
+
pass # Implement sales_growth function here...
|
|
|
|
| 47 |
|
| 48 |
def merge_forecast_data(actual, predicted, future):
|
| 49 |
+
pass # Implement merge_forecast_data function here...
|
|
|
|
| 50 |
|
| 51 |
def interpret_mape(mape_score):
|
| 52 |
+
pass # Implement interpret_mape function here...
|
|
|
|
| 53 |
|
| 54 |
def load_tapas_model():
|
| 55 |
model_name = "google/tapas-large-finetuned-wtq"
|
|
|
|
| 65 |
return answers
|
| 66 |
|
| 67 |
def convert_answer(answer):
|
| 68 |
+
pass # Implement convert_answer function here...
|
|
|
|
| 69 |
|
| 70 |
def get_converted_answer(table, query):
|
| 71 |
+
pass # Implement get_converted_answer function here...
|
|
|
|
| 72 |
|
| 73 |
# Gradio Interface with emojis and colors
|
| 74 |
def upload_and_forecast(uploaded_file, period):
|
|
|
|
| 122 |
# Return the figures and growth data
|
| 123 |
return fig_compare, fig_forecast, future_sales_growth
|
| 124 |
|
| 125 |
+
# Gradio Interface setup with external CSS file
|
| 126 |
iface = gr.Interface(
|
| 127 |
fn=upload_and_forecast,
|
| 128 |
inputs=[
|
|
|
|
| 136 |
],
|
| 137 |
live=True,
|
| 138 |
theme="compact",
|
| 139 |
+
title="Sales Forecasting System ✨",
|
| 140 |
+
description="Upload your sales data to start forecasting 🚀",
|
| 141 |
+
layout="horizontal", # Add a horizontal layout for better alignment
|
| 142 |
+
css=open("styles.css", "r").read() # Load the external CSS file here
|
| 143 |
)
|
| 144 |
|
| 145 |
iface.launch()
|
styles.css
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* styles.css */
|
| 2 |
+
.gradio-container {
|
| 3 |
+
background-color: #f0f8ff; /* Light Blue */
|
| 4 |
+
}
|
| 5 |
+
.gradio-input, .gradio-slider {
|
| 6 |
+
background-color: #e0ffff; /* Light Cyan */
|
| 7 |
+
color: #006400; /* Dark Green */
|
| 8 |
+
}
|
| 9 |
+
.gradio-button {
|
| 10 |
+
background-color: #98fb98; /* Pale Green */
|
| 11 |
+
color: #006400; /* Dark Green */
|
| 12 |
+
}
|
| 13 |
+
.gradio-output {
|
| 14 |
+
background-color: #fffacd; /* Lemon Chiffon */
|
| 15 |
+
}
|