{ "id": "build-small-hackathon/InContext", "slug": "InContext", "title": "InContext", "sdk": "gradio", "declared_models": [], "tags": [ "gradio", "region:us" ], "app_file": "app.py", "README": "Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference", "APP_FILE": "from transformers import AutoModelForCausalLM, AutoTokenizer\n\nimport gradio as gr\nimport torch\nimport json\nimport html\nimport traceback\nfrom transformers import AutoModelForCausalLM, AutoTokenizer\n\nprint(\"Loading model...\")\nmodel_name = \"Qwen/Qwen2.5-0.5B-Instruct\"\ntokenizer = AutoTokenizer.from_pretrained(model_name)\nmodel = AutoModelForCausalLM.from_pretrained(\n model_name,\n torch_dtype=torch.float16,\n device_map=\"auto\"\n)\nprint(\"Model loaded.\")\n\nSYSTEM_PROMPT = \"\"\"You are an English learning assistant. Extract 8-20 useful expressions from the text.\nFor each expression, output a JSON object with keys: expression, meaning, explanation, original_context, extra_example.\nMeaning and explanation should be in Chinese.\nOutput must be a JSON array. No extra text.\"\"\"\n\ndef analyze(text):\n try:\n if not text or len(text.strip()) < 20:\n return \"