Spaces:
Runtime error
Runtime error
mouliraj56
commited on
Commit
•
d5debec
1
Parent(s):
ad37ff6
Update app.py
Browse files
app.py
CHANGED
@@ -55,7 +55,18 @@ def forecast_stock(ticker, period, interval):
|
|
55 |
|
56 |
true_predictions = scaler.inverse_transform(test_predictions)
|
57 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
|
|
|
|
|
59 |
fig = plt.figure(figsize=(10, 6))
|
60 |
plt.plot(ts.index, ts.values, label='Original Data')
|
61 |
plt.plot(ts_test.index, true_predictions, label='Forecasted Data')
|
@@ -69,7 +80,8 @@ def forecast_stock(ticker, period, interval):
|
|
69 |
|
70 |
except Exception as e:
|
71 |
print(f"An error occurred: {e}")
|
72 |
-
return
|
|
|
73 |
|
74 |
tickers_info="""
|
75 |
**Ticker Examples**
|
@@ -95,9 +107,6 @@ tickers_info="""
|
|
95 |
- **QQQ:** Invesco QQQ Trust
|
96 |
- **IWM:** iShares Russell 2000 ETF
|
97 |
"""
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
with gr.Blocks() as demo:
|
102 |
gr.Interface(
|
103 |
forecast_stock, # Function to execute on submit
|
|
|
55 |
|
56 |
true_predictions = scaler.inverse_transform(test_predictions)
|
57 |
|
58 |
+
# # Plot results
|
59 |
+
# plt.figure(figsize=(10, 6))
|
60 |
+
# plt.plot(ts.index, ts.values, label='Original Data')
|
61 |
+
# plt.plot(ts_test.index, true_predictions, label='Forecasted Data')
|
62 |
+
# plt.legend()
|
63 |
+
# plt.xlabel('Time')
|
64 |
+
# plt.ylabel('Value')
|
65 |
+
# plt.title('Stock Price Forecast')
|
66 |
+
# plt.switch_backend("TkAgg")
|
67 |
|
68 |
+
|
69 |
+
# return plt.show() # Indicate successful execution
|
70 |
fig = plt.figure(figsize=(10, 6))
|
71 |
plt.plot(ts.index, ts.values, label='Original Data')
|
72 |
plt.plot(ts_test.index, true_predictions, label='Forecasted Data')
|
|
|
80 |
|
81 |
except Exception as e:
|
82 |
print(f"An error occurred: {e}")
|
83 |
+
return False # Indicate error
|
84 |
+
|
85 |
|
86 |
tickers_info="""
|
87 |
**Ticker Examples**
|
|
|
107 |
- **QQQ:** Invesco QQQ Trust
|
108 |
- **IWM:** iShares Russell 2000 ETF
|
109 |
"""
|
|
|
|
|
|
|
110 |
with gr.Blocks() as demo:
|
111 |
gr.Interface(
|
112 |
forecast_stock, # Function to execute on submit
|