Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -11,20 +11,20 @@ model=joblib.load('crypto.pkl')
|
|
| 11 |
scaler_x=joblib.load('scaler_x.pkl')
|
| 12 |
|
| 13 |
@app.route('/')
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
response = requests.get('https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies=usd', timeout=5)
|
| 18 |
response.raise_for_status()
|
| 19 |
data = response.json()
|
| 20 |
btc_price = data['bitcoin']['usd']
|
| 21 |
print(f"BTC Price: {btc_price}") # Debug print
|
| 22 |
-
|
| 23 |
print("Error fetching price:", e)
|
| 24 |
btc_price = "Error fetching price"
|
| 25 |
|
| 26 |
-
|
| 27 |
-
|
| 28 |
|
| 29 |
|
| 30 |
|
|
|
|
| 11 |
scaler_x=joblib.load('scaler_x.pkl')
|
| 12 |
|
| 13 |
@app.route('/')
|
| 14 |
+
def home():
|
| 15 |
+
print("HOME ROUTE ACCESSED!") # Debug print
|
| 16 |
+
try:
|
| 17 |
response = requests.get('https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies=usd', timeout=5)
|
| 18 |
response.raise_for_status()
|
| 19 |
data = response.json()
|
| 20 |
btc_price = data['bitcoin']['usd']
|
| 21 |
print(f"BTC Price: {btc_price}") # Debug print
|
| 22 |
+
except Exception as e:
|
| 23 |
print("Error fetching price:", e)
|
| 24 |
btc_price = "Error fetching price"
|
| 25 |
|
| 26 |
+
print("Rendering home.html") # Debug print
|
| 27 |
+
return render_template('home.html', btc_price=btc_price)
|
| 28 |
|
| 29 |
|
| 30 |
|