Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
File size: 2,439 Bytes
d0b2e68 d52dc83 d0b2e68 d52dc83 d0b2e68 d52dc83 d0b2e68 |
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 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
import os
from adapter import *
HF_TOKEN = os.getenv("HUGGINGFACEHUB_API_TOKEN")
PRIVATE_DATASET_REPO = "Chris1/recaptcha_datasets"
PROMPT_TYPES = {
"Binary per tile (yes/no)": 1,
"Multiclass per tile (class name)": 2,
}
MODEL_PROVIDERS = [
"Manual",
BaseAdapter.OPENAI,
BaseAdapter.ANTHROPIC,
BaseAdapter.GEMINI,
BaseAdapter.MISTRAL,
BaseAdapter.GROK,
]
MISTRAL_MODELS = ['mistral-medium-latest']
GROK_MODELS = [
'grok-4-0709',
'grok-4-fast-reasoning'
]
ANTHROPIC_MODELS = [
'claude-4-opus-20250514',
'claude-opus-4-1-20250805',
'claude-opus-4-5-20251101',
'claude-sonnet-4-5-20250929',
'claude-haiku-4-5-20251001',
'claude-4-sonnet-20250514']
GEMINI_MODELS = [
'gemini-1.0-pro',
'gemini-1.5-pro',
'gemini-1.5-flash',
'gemini-1.5-pro-002',
'gemini-2.0-flash',
'gemini-2.0-flash-lite',
'gemini-2.5-flash',
'gemini-2.5-pro',
'gemini-3-pro-preview'
]
OPENAI_MODELS = [
'gpt-4o-2024-11-20',
'gpt-4o-mini-2024-07-18',
'gpt-4.5-preview-2025-02-27',
'gpt-4.1-2025-04-14',
'gpt-5.1',
'gpt-5-2025-08-07',
'gpt-5-mini-2025-08-07',
'gpt-5-nano-2025-08-07'
]
MODEL_PROVIDERS = {
BaseAdapter.OPENAI : OPENAI_MODELS ,
BaseAdapter.ANTHROPIC : ANTHROPIC_MODELS,
BaseAdapter.GEMINI : GEMINI_MODELS,
BaseAdapter.MISTRAL : MISTRAL_MODELS,
BaseAdapter.GROK : GROK_MODELS,
#BaseAdapter.COHERE : [],
#BaseAdapter.TOGETHER : []
}
MODEL_ADAPTERS = {
BaseAdapter.OPENAI : OPENAI_MODELS ,
BaseAdapter.ANTHROPIC : ANTHROPIC_MODELS,
BaseAdapter.GEMINI : GEMINI_MODELS,
BaseAdapter.MISTRAL : MISTRAL_MODELS,
BaseAdapter.GROK : GROK_MODELS,
#BaseAdapter.COHERE : [],
#BaseAdapter.TOGETHER : []
}
# -----------------------------
# Prompt Builders & Parsers
# -----------------------------
def build_prompt_3(category: str) -> str:
return (
"Select the images which are of the category '" + category + "' "
"from left to right, top to bottom, indexed 1 to 9. "
"Return only the valid numbers separated by spaces or commas."
)
def build_prompt_1(category: str) -> str:
return "Is the object in the image a '" + category + "'? Answer with yes or no only."
def build_prompt_2(categories: List[str]) -> str:
cats = ", ".join(categories)
return (
"Predict the category of the provided image among the set of categories: "
+ cats + ". Return exactly and only the class name."
) |