🏒 Hockey Mind AI Chatbot
Get personalized hockey advice and video recommendations!
Optimized for field hockey coaching, training, and player development
#!/usr/bin/env python3 """ Hockey Mind AI Chatbot - Fixed Gradio Interface for Hugging Face Spaces """ import gradio as gr import asyncio import os from dotenv import load_dotenv from OpenAPI_DB import agentic_hockey_chat # Load environment variables load_dotenv() # Global variable to track if resources are loaded resources_loaded = False async def chat_interface(user_role, user_team, user_prompt): """Interface function for Gradio""" global resources_loaded try: # Load resources on first use to save memory if not resources_loaded: try: from OpenAPI_DB import load_resources load_resources() resources_loaded = True except ImportError as import_err: return f"Import Error: {str(import_err)}. Please check if all required packages are installed.", "Unable to load ML models." # Call the main chat function result = await agentic_hockey_chat(user_role, user_team, user_prompt) # Format response for Gradio ai_response = result.get('ai_response', 'Sorry, no response generated.') recommendations = result.get('recommended_content_details', []) # Format recommendations as HTML rec_html = "" if recommendations: rec_html = "
Get personalized hockey advice and video recommendations!
Optimized for field hockey coaching, training, and player development
🏒 Hockey Mind AI - Powered by OpenRouter & Sentence Transformers
Supports English & Dutch | Built for field hockey community