sigrid-hal9's picture
Upload folder using huggingface_hub
0eb2e78 verified
Raw History Blame Contribute Delete
3.19 kB
"""Keyword rules shared by collect.py (relevance filter) and code.py (coding)."""
import re
I = re.I
DEPLOY_T = re.compile(r"\b(deploy\w*|hosting|hosted|production|prod\b|publish\w*|self-host\w*|"
r"cloud ?run|app service|azd|provision\w*|lambda|serverless|edge (function|runtime)|"
r"vercel|netlify|railway|render\.com|on render|fly\.io|heroku|cloudflare|"
r"kubernetes|k8s|helm|sagemaker|runpod|modal|spaces?\b|aws|azure|gcp|ecs|eks|gke|docker)", I)
AI = re.compile(r"\b(ai|llm\w*|openai|gpt[-\w]*|chatgpt|langchain\w*|langgraph|llama\w*|ollama|gradio|"
r"hugging ?face|transformers|model|embedding\w*|rag|chatbot|anthropic|claude|gemini|"
r"vertex|bedrock|mistral|vllm|tgi|inference|agent\w*|ai[- ]sdk|ai gateway|mcp|whisper|"
r"stable diffusion|torch|pytorch|tensorflow|gpu|cuda)\b", I)
# known false-positive senses of "deploy"/"deployment"
FALSE_SENSE = re.compile(r"(deployment[_ ]?name|azure_openai_deployment|model deployment(?! to)|"
r"deployment_id|\bdeployment\b of (gpt|the model)|azure ?openai deployment)", I)
# Rule 8 (owner decision 2026-10-28): in general-purpose frameworks (Streamlit, Gradio, Next.js, host CLIs)
# the thread itself must show an AI app; the framework's name is not evidence.
AI_EVIDENCE = re.compile(r"\b(ai|a\.i\.|llms?|large language|openai|gpt[-\w]*|chatgpt|langchain\w*|langgraph|llama\w*|ollama|"
r"hugging ?face|transformers|(ml|ai|llm|language|diffusion|whisper|vision|embedding|chat) models?|"
r"models? (inference|weights|loading|card|repo)|(load|run|serve|host)(s|ing)? (the |a |my )?models?|"
r"embedding\w*|rag|chat ?bot\w*|anthropic|claude|gemini|vertex ai|bedrock|mistral|qwen|deepseek|"
r"vllm|tgi|inference|agents?|ai[- ]sdk|mcp|whisper|stable diffusion|diffusers|automatic1111|comfyui|sdxl|lora|flux|text-to-\\w+|speech|tts|asr|ocr|torch|pytorch|tensorflow|"
r"cuda|gpu|machine learning|deep learning|zerogpu|prompt|tokens?|cursor|copilot|lovable|bolt|v0)\b", I)
GENERIC_REPOS = {"streamlit/streamlit", "gradio-app/gradio", "vercel/next.js", "vercel/vercel", "netlify/cli",
"superfly/flyctl", "railwayapp/cli"}
LOCAL_ONLY = re.compile(r"\b(localhost|local(ly)? (deploy|install|run)|on my (mac|laptop|pc)|windows 1[01])\b", I)
def keep(h):
title, body, g = h["title"], h.get("body", ""), h["group"]
text = title + "\n" + body
if g == "host":
if AI.search(title):
return True, "host:ai_in_title"
if AI.search(body) and DEPLOY_T.search(title):
return True, "host:ai_in_body+deploy_title"
return False, "host:no_ai"
if not DEPLOY_T.search(title):
return False, "no_deploy_term_in_title"
if g == "framework_generic" and not AI_EVIDENCE.search(text):
return False, "generic_framework:no_ai"
if FALSE_SENSE.search(title) and not re.search(r"deploy(ed|ing)? (to|on)\b", title, I):
return False, "false_sense:model_deployment_name"
return True, f"{g}:deploy_title"