ineq_demo / app.py
lorn666's picture
Update app.py
e0cd809 verified
import gradio as gr
import os
import gradio_leaderboard
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() as demo:
gr.Markdown(f"# Embedded Space: {SPACE_REPO_ID}")
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()