Spaces:
Runtime error
Runtime error
| """ | |
| Vercel Serverless Function Entry Point | |
| This file adapts Flask to work with Vercel's serverless functions. | |
| Uses proper WSGI adapter for Vercel's Python runtime. | |
| """ | |
| from flask import Flask, render_template, jsonify | |
| import os | |
| import sys | |
| # Simple Flask app for Vercel (minimal version to avoid crashes) | |
| app = Flask(__name__, | |
| template_folder='../templates', | |
| static_folder='../static') | |
| # Basic routes that work in serverless | |
| def index(): | |
| """Main page""" | |
| return render_template('index.html') | |
| def health(): | |
| """Health check endpoint""" | |
| return jsonify({'status': 'ok', 'platform': 'vercel'}) | |
| def login(): | |
| return render_template('login.html') | |
| def pricing(): | |
| return render_template('pricing.html') | |
| def accumulators(): | |
| return render_template('accumulators.html') | |
| def profile(): | |
| return render_template('profile.html') | |
| def tracker(): | |
| return render_template('tracker.html') | |
| def leaderboard(): | |
| return render_template('leaderboard.html') | |
| def dashboard(): | |
| return render_template('dashboard.html') | |
| # API endpoints (simplified for serverless) | |
| def get_leagues(): | |
| """Get available leagues""" | |
| leagues = [ | |
| {'id': 'bundesliga', 'name': 'Bundesliga', 'country': 'Germany'}, | |
| {'id': 'premier_league', 'name': 'Premier League', 'country': 'England'}, | |
| {'id': 'la_liga', 'name': 'La Liga', 'country': 'Spain'}, | |
| {'id': 'serie_a', 'name': 'Serie A', 'country': 'Italy'}, | |
| {'id': 'ligue_1', 'name': 'Ligue 1', 'country': 'France'}, | |
| ] | |
| return jsonify({'success': True, 'leagues': leagues}) | |
| def get_fixtures(): | |
| """Get demo fixtures for serverless""" | |
| fixtures = [ | |
| { | |
| 'id': '1', | |
| 'home_team': 'Bayern Munich', | |
| 'away_team': 'Dortmund', | |
| 'home_prob': 0.65, | |
| 'draw_prob': 0.20, | |
| 'away_prob': 0.15, | |
| 'confidence': 0.88 | |
| }, | |
| { | |
| 'id': '2', | |
| 'home_team': 'Leverkusen', | |
| 'away_team': 'Leipzig', | |
| 'home_prob': 0.45, | |
| 'draw_prob': 0.30, | |
| 'away_prob': 0.25, | |
| 'confidence': 0.75 | |
| } | |
| ] | |
| return jsonify({'success': True, 'fixtures': fixtures}) | |
| def get_pricing(): | |
| """Get pricing info""" | |
| return jsonify({ | |
| 'success': True, | |
| 'tiers': [ | |
| {'id': 'free', 'name': 'Free', 'price': 0}, | |
| {'id': 'pro', 'name': 'Pro', 'price': 9.99}, | |
| {'id': 'premium', 'name': 'Premium', 'price': 24.99} | |
| ] | |
| }) | |
| def get_accumulators(): | |
| """Get demo accumulators""" | |
| return jsonify({ | |
| 'success': True, | |
| 'accumulators': { | |
| 'safe': { | |
| 'picks': [ | |
| {'home_team': 'Bayern', 'away_team': 'Augsburg', 'selection': 'Over 0.5 Goals', 'odds': 1.10} | |
| ], | |
| 'combined_odds': 1.79, | |
| 'combined_probability': 0.768, | |
| 'potential_return': 36, | |
| 'stake_suggestion': 20 | |
| } | |
| } | |
| }) | |
| # Vercel needs the app to handle requests | |
| if __name__ == '__main__': | |
| app.run(debug=True) | |