Spaces:
Running
Running
File size: 2,572 Bytes
3083fe6 5715460 6399a7e 0963be5 3083fe6 170fbef 3083fe6 0963be5 3083fe6 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
import gradio as gr
import os
from src.assets import custom_css
# Additional CSS to override remote Space styling
override_css = custom_css + """
/* Force override remote Space styling with higher specificity */
div.gradio-container .gradio-dataframe th,
div.gradio-container div.gradio-dataframe th,
.gr-box .gradio-dataframe th,
.gr-form .gradio-dataframe th,
body .gradio-dataframe th,
html .gradio-dataframe th {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
color: white !important;
font-weight: 600 !important;
border: 1px solid rgba(255,255,255,0.2) !important;
}
/* Override hover effects */
div.gradio-container .gradio-dataframe th:hover,
div.gradio-container div.gradio-dataframe th:hover,
.gr-box .gradio-dataframe th:hover,
body .gradio-dataframe th:hover {
background: linear-gradient(135deg, #5a6fd8 0%, #6b4190 100%) !important;
transform: translateY(-1px) !important;
box-shadow: 0 3px 6px rgba(0,0,0,0.15) !important;
}
/* Override table row hover */
div.gradio-container .gradio-dataframe tbody tr:hover,
body .gradio-dataframe tbody tr:hover {
background-color: #e3f2fd !important;
}
/* Additional React table styling overrides */
.leaderboard-table-container .header-cell,
.leaderboard-table .header-cell,
div .header-cell,
body .header-cell {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
color: white !important;
}
.leaderboard-table-container .header-cell:hover,
.leaderboard-table .header-cell:hover,
div .header-cell:hover,
body .header-cell:hover {
background: linear-gradient(135deg, #5a6fd8 0%, #6b4190 100%) !important;
}
"""
SPACE_REPO_ID = "IneqMath/IneqMath_Judge_Private"
hf_token = os.environ.get("HF_TOKEN")
if not hf_token:
try:
import getpass
hf_token = getpass.getpass("Enter your Hugging Face token (input hidden): ")
except Exception:
hf_token = input("Enter your Hugging Face token: ")
if not hf_token:
print("[ERROR] Hugging Face token is required. Set HF_TOKEN env variable or enter it when prompted.")
exit(1)
remote_space = None
load_error = None
try:
remote_space = gr.load(f"spaces/{SPACE_REPO_ID}", hf_token=hf_token)
except Exception as e:
load_error = str(e)
print(f"[ERROR] Failed to load remote Space: {load_error}")
with gr.Blocks(css=override_css) as demo:
if remote_space is not None:
remote_space.render()
else:
gr.Markdown(f"**Failed to load remote Space.**\n\nError: {load_error}")
if __name__ == "__main__":
demo.launch() |