Spaces:
Sleeping
Sleeping
debug
Browse files- src/streamlit_app.py +5 -2
src/streamlit_app.py
CHANGED
|
@@ -2,6 +2,9 @@
|
|
| 2 |
Chess AI - Hugging Face Spaces
|
| 3 |
Entry point: app.py
|
| 4 |
"""
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
import streamlit as st
|
| 7 |
import chess
|
|
@@ -52,13 +55,13 @@ h1, h2, h3 { font-family: 'Playfair Display', serif; color: #f0c060; }
|
|
| 52 |
# ─── Cached resource loading ─────────────────────────────────────────────────
|
| 53 |
@st.cache_resource(show_spinner="Đang tải Chess Engine...")
|
| 54 |
def load_engine():
|
| 55 |
-
from
|
| 56 |
return config, engine
|
| 57 |
|
| 58 |
@st.cache_resource(show_spinner="Đang tải ML Model...")
|
| 59 |
def load_ml_agent():
|
| 60 |
try:
|
| 61 |
-
from .ai_battle import MLAgent
|
| 62 |
return MLAgent(), None
|
| 63 |
except Exception as e:
|
| 64 |
return None, str(e)
|
|
|
|
| 2 |
Chess AI - Hugging Face Spaces
|
| 3 |
Entry point: app.py
|
| 4 |
"""
|
| 5 |
+
import sys
|
| 6 |
+
import os
|
| 7 |
+
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
| 8 |
|
| 9 |
import streamlit as st
|
| 10 |
import chess
|
|
|
|
| 55 |
# ─── Cached resource loading ─────────────────────────────────────────────────
|
| 56 |
@st.cache_resource(show_spinner="Đang tải Chess Engine...")
|
| 57 |
def load_engine():
|
| 58 |
+
from src import config, engine
|
| 59 |
return config, engine
|
| 60 |
|
| 61 |
@st.cache_resource(show_spinner="Đang tải ML Model...")
|
| 62 |
def load_ml_agent():
|
| 63 |
try:
|
| 64 |
+
from src.ai_battle import MLAgent
|
| 65 |
return MLAgent(), None
|
| 66 |
except Exception as e:
|
| 67 |
return None, str(e)
|