#!/usr/bin/env python3
"""
PRISM Benchmark - Hugging Face Space
Phục vụ website HTML tĩnh qua Flask với CSS tối ưu cho bảng
"""
from flask import Flask, send_from_directory
import os
app = Flask(__name__, static_folder=".", static_url_path="")
# CSS tối ưu cho bảng
TABLE_CSS = """
"""
# Đọc index.html
with open("index.html", "r", encoding="utf-8") as f:
index_content = f.read()
# Thêm CSS vào head
if "" in index_content:
index_content = index_content.replace("", TABLE_CSS + "")
@app.route("/")
def index():
return index_content
@app.route("/")
def serve_file(filename):
"""Phục vụ các file tĩnh"""
try:
return send_from_directory(".", filename)
except:
# Nếu file không tồn tại, trả về index.html
return index_content
@app.route("/demo/")
def demo():
"""Route cho demo page"""
demo_file = "demo/index.html"
if os.path.exists(demo_file):
with open(demo_file, "r", encoding="utf-8") as f:
content = f.read()
# Thêm CSS vào demo page
if "" in content:
content = content.replace("", TABLE_CSS + "")
return content
return index_content
if __name__ == "__main__":
app.run(host="0.0.0.0", port=7860, debug=False)