Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -48,8 +48,8 @@ model.load_state_dict(torch.load(model_path))
|
|
48 |
|
49 |
model.eval()
|
50 |
|
51 |
-
def predict_and_plot(
|
52 |
-
last_four_weeks = [
|
53 |
|
54 |
custom_input = prepare_custom_input(last_four_weeks, seq_length, scaler)
|
55 |
|
@@ -63,9 +63,9 @@ def predict_and_plot(week1, week2, week3, week4):
|
|
63 |
predicted_value = f"{predicted_kilometers[0][0]:.2f}"
|
64 |
|
65 |
weeks = ['Week -4', 'Week -3', 'Week -2', 'Week -1', 'Predicted Week']
|
66 |
-
actual_values = [
|
67 |
|
68 |
-
plt.figure(figsize=(
|
69 |
plt.plot(weeks, actual_values, marker='o', label='Total Kilometers')
|
70 |
plt.axvline(x='Predicted Week', color='red', linestyle='--', label='Predicted Week')
|
71 |
plt.title('Total Kilometers for Last 4 Weeks and Prediction')
|
|
|
48 |
|
49 |
model.eval()
|
50 |
|
51 |
+
def predict_and_plot(week4, week3, week2, week1):
|
52 |
+
last_four_weeks = [week4, week3, week2, week1]
|
53 |
|
54 |
custom_input = prepare_custom_input(last_four_weeks, seq_length, scaler)
|
55 |
|
|
|
63 |
predicted_value = f"{predicted_kilometers[0][0]:.2f}"
|
64 |
|
65 |
weeks = ['Week -4', 'Week -3', 'Week -2', 'Week -1', 'Predicted Week']
|
66 |
+
actual_values = [week4, week3, week2, week1, predicted_value]
|
67 |
|
68 |
+
plt.figure(figsize=(10, 6))
|
69 |
plt.plot(weeks, actual_values, marker='o', label='Total Kilometers')
|
70 |
plt.axvline(x='Predicted Week', color='red', linestyle='--', label='Predicted Week')
|
71 |
plt.title('Total Kilometers for Last 4 Weeks and Prediction')
|