Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,7 +4,6 @@ import tensorflow as tf
|
|
| 4 |
import joblib
|
| 5 |
import numpy as np
|
| 6 |
import pandas as pd
|
| 7 |
-
import yfinance as yf
|
| 8 |
from huggingface_hub import hf_hub_download
|
| 9 |
|
| 10 |
os.environ['CUDA_VISIBLE_DEVICES'] = '-1'
|
|
@@ -54,12 +53,7 @@ def forecast_stock(input_name, model, scalers_dict, input_width=60):
|
|
| 54 |
if not ticker:
|
| 55 |
return "Error: Invalid stock ticker."
|
| 56 |
print(f"\n--- Generating forecast for {ticker} ---")
|
| 57 |
-
|
| 58 |
-
data_df = yf.download(ticker, period="1y", progress=False)
|
| 59 |
-
if data_df.empty:
|
| 60 |
-
return f"Error: No data found for ticker {ticker}. It may be delisted or invalid."
|
| 61 |
-
except Exception as e:
|
| 62 |
-
return f"Error fetching data for {ticker}: {e}"
|
| 63 |
if len(data_df) < input_width:
|
| 64 |
return f"Error: Not enough historical data. Need {input_width} days, but only have {len(data_df)}."
|
| 65 |
recent_data = data_df.tail(input_width)
|
|
|
|
| 4 |
import joblib
|
| 5 |
import numpy as np
|
| 6 |
import pandas as pd
|
|
|
|
| 7 |
from huggingface_hub import hf_hub_download
|
| 8 |
|
| 9 |
os.environ['CUDA_VISIBLE_DEVICES'] = '-1'
|
|
|
|
| 53 |
if not ticker:
|
| 54 |
return "Error: Invalid stock ticker."
|
| 55 |
print(f"\n--- Generating forecast for {ticker} ---")
|
| 56 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
if len(data_df) < input_width:
|
| 58 |
return f"Error: Not enough historical data. Need {input_width} days, but only have {len(data_df)}."
|
| 59 |
recent_data = data_df.tail(input_width)
|