Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,13 +9,13 @@ import json
|
|
| 9 |
# Login using secret (secure, no hardcode)
|
| 10 |
login(os.environ["HF_TOKEN"])
|
| 11 |
|
| 12 |
-
# Model setup (loads once on Space startup)
|
| 13 |
-
model_id = "agarkovv/CryptoTrader-LM"
|
| 14 |
-
base_model_id = "
|
| 15 |
MAX_LENGTH = 32768
|
| 16 |
DEVICE = "cuda" if torch.cuda.is_available() else "cpu" # Use GPU if available (ZeroGPU on HF)
|
| 17 |
|
| 18 |
-
# Workaround: Download model files, edit adapter_config.json to remove 'model_type'
|
| 19 |
local_dir = snapshot_download(repo_id=model_id)
|
| 20 |
config_path = os.path.join(local_dir, "adapter_config.json")
|
| 21 |
with open(config_path, 'r') as f:
|
|
@@ -62,8 +62,8 @@ demo = gr.Interface(
|
|
| 62 |
fn=predict_trading_decision,
|
| 63 |
inputs=gr.Textbox(label="Input Prompt (News + Prices)"),
|
| 64 |
outputs=gr.Textbox(label="Trading Decision"),
|
| 65 |
-
title="CryptoTrader-LM MCP Tool",
|
| 66 |
-
description="Predict buy/sell/hold for BTC/ETH."
|
| 67 |
)
|
| 68 |
|
| 69 |
# Launch with MCP support
|
|
|
|
| 9 |
# Login using secret (secure, no hardcode)
|
| 10 |
login(os.environ["HF_TOKEN"])
|
| 11 |
|
| 12 |
+
# Model setup (loads once on Space startup; switched to Llama 3 base)
|
| 13 |
+
model_id = "agarkovv/CryptoTrader-LM" # Keep PEFT adapter if compatible; otherwise fine-tune on Llama
|
| 14 |
+
base_model_id = "meta-llama/Meta-Llama-3-8B-Instruct"
|
| 15 |
MAX_LENGTH = 32768
|
| 16 |
DEVICE = "cuda" if torch.cuda.is_available() else "cpu" # Use GPU if available (ZeroGPU on HF)
|
| 17 |
|
| 18 |
+
# Workaround: Download model files, edit adapter_config.json to remove 'model_type' if present
|
| 19 |
local_dir = snapshot_download(repo_id=model_id)
|
| 20 |
config_path = os.path.join(local_dir, "adapter_config.json")
|
| 21 |
with open(config_path, 'r') as f:
|
|
|
|
| 62 |
fn=predict_trading_decision,
|
| 63 |
inputs=gr.Textbox(label="Input Prompt (News + Prices)"),
|
| 64 |
outputs=gr.Textbox(label="Trading Decision"),
|
| 65 |
+
title="CryptoTrader-LM with Llama MCP Tool",
|
| 66 |
+
description="Predict buy/sell/hold for BTC/ETH using Llama 3 base."
|
| 67 |
)
|
| 68 |
|
| 69 |
# Launch with MCP support
|