Spaces:
Runtime error
Runtime error
Create model.py
Browse files
model.py
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# models.py
|
2 |
+
from pydantic import BaseModel, ConfigDict
|
3 |
+
|
4 |
+
|
5 |
+
class GoogleModelID:
|
6 |
+
GEMINI_2_0_FLASH = "gemini-2.0-flash"
|
7 |
+
GEMINI_2_5_FLASH_PREVIEW = "gemini-2.5-flash"
|
8 |
+
|
9 |
+
class OpenRouterModelID:
|
10 |
+
QWEN_3_14B_FREE = "openrouter/qwen/qwen3-14b:free"
|
11 |
+
GPT_4_1_MINI = "openrouter/openai/gpt-4.1-mini"
|
12 |
+
GPT_O4_MINI = "openrouter/openai/o4-mini"
|
13 |
+
GPT_O4_MINI_HIGH = "openrouter/openai/o4-mini-high"
|
14 |
+
GROK_3_MINI_BETA = "openrouter/x-ai/grok-3-mini-beta"
|
15 |
+
GROK_3_BETA = "openrouter/x-ai/grok-3-beta"
|
16 |
+
|
17 |
+
class Question(BaseModel):
|
18 |
+
model_config = ConfigDict(validate_by_name=True, validate_by_alias=True)
|
19 |
+
task_id: str
|
20 |
+
question: str
|
21 |
+
file_name: str
|
22 |
+
level: str # Added level as it's present in questions.json
|
23 |
+
|
24 |
+
class Answer(BaseModel):
|
25 |
+
task_id: str
|
26 |
+
answer: str
|
27 |
+
|
28 |
+
class QuestionAnswerPair(BaseModel):
|
29 |
+
task_id: str
|
30 |
+
question: str
|
31 |
+
answer: str
|
32 |
+
|
33 |
+
def get_answer(self) -> dict[str, str]:
|
34 |
+
return {"task_id": self.task_id, "submitted_answer": self.answer}
|
35 |
+
|
36 |
+
class Results(BaseModel):
|
37 |
+
model_config = ConfigDict(from_attributes=True)
|
38 |
+
username: str
|
39 |
+
score: int
|
40 |
+
correct_count: int
|
41 |
+
total_attempted: int
|
42 |
+
message: str
|
43 |
+
timestamp: str
|
44 |
+
|