Spaces:
Sleeping
Sleeping
Create model_inference.py
Browse files- utils/model_inference.py +20 -0
utils/model_inference.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import tensorflow as tf
|
| 2 |
+
import joblib
|
| 3 |
+
import pandas as pd
|
| 4 |
+
|
| 5 |
+
def load_lstm_model(path="models/lstm_forex_model.h5"):
|
| 6 |
+
return tf.keras.models.load_model(path)
|
| 7 |
+
|
| 8 |
+
def load_sac_model(path="models/reconstructed_sac_forex_trading_model.zip"):
|
| 9 |
+
return joblib.load(path)
|
| 10 |
+
|
| 11 |
+
def generate_forex_signals(capital, risk_level):
|
| 12 |
+
# Logic to combine LSTM and SAC predictions
|
| 13 |
+
# Return currency pair, entry/exit times, ROI, signal strength
|
| 14 |
+
return {
|
| 15 |
+
"currency_pair": "EUR/USD",
|
| 16 |
+
"entry_time": "10:15 AM",
|
| 17 |
+
"exit_time": "2:45 PM",
|
| 18 |
+
"roi": 15.6,
|
| 19 |
+
"signal_strength": "High"
|
| 20 |
+
}
|