Spaces:
Sleeping
Sleeping
Update models.py
Browse files
models.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
from typing import List, Optional, Union
|
2 |
from pydantic import BaseModel, Field
|
3 |
|
4 |
class Location(BaseModel):
|
@@ -7,45 +7,40 @@ class Location(BaseModel):
|
|
7 |
lon: float
|
8 |
relevance: str = Field(description="Why this location matters in the historical context")
|
9 |
|
10 |
-
class
|
|
|
11 |
range: List[int] = Field(description="Start and end years for the time period")
|
12 |
explanation: str = Field(description="Historical significance of this time period")
|
13 |
|
14 |
-
class
|
|
|
|
|
|
|
|
|
|
|
15 |
level: str = Field(description="Level of style detail (movement/sub_movement/specific)")
|
16 |
options: List[str] = Field(description="Available artistic styles for selection")
|
17 |
explanation: str = Field(description="Historical context for the artistic styles")
|
18 |
|
19 |
-
class
|
20 |
-
|
21 |
-
|
22 |
|
23 |
class AxisImpact(BaseModel):
|
24 |
-
temporal: Optional[str] = Field(description="How time period affects this axis")
|
25 |
-
geographical: Optional[str] = Field(description="How location affects this axis")
|
26 |
-
style: Optional[str] = Field(description="How artistic style affects this axis")
|
27 |
-
|
28 |
-
class
|
29 |
-
component: str
|
30 |
-
current_zoom:
|
31 |
-
available_zooms:
|
32 |
-
impacted_by: AxisImpact
|
33 |
-
|
34 |
-
class GeographicalConfig(BaseModel):
|
35 |
-
component: str = Field(default="st.map")
|
36 |
-
current_zoom: GeographicalZoom
|
37 |
-
available_zooms: dict[str, GeographicalZoom] = Field(description="Available zoom levels (in/out)")
|
38 |
-
impacted_by: AxisImpact
|
39 |
-
|
40 |
-
class StyleConfig(BaseModel):
|
41 |
-
component: str = Field(default="st.multiselect")
|
42 |
-
current_zoom: StyleConfig
|
43 |
-
|
44 |
class Analysis(BaseModel):
|
45 |
query_focus: str = Field(description="Main subject of the query")
|
46 |
historical_context: str = Field(description="Brief historical context")
|
47 |
|
48 |
class ArtHistoryResponse(BaseModel):
|
49 |
analysis: Analysis
|
50 |
-
axis_configurations:
|
51 |
-
Field(description="Configuration for each axis (temporal, geographical, style)")
|
|
|
1 |
+
from typing import List, Optional, Union, Dict
|
2 |
from pydantic import BaseModel, Field
|
3 |
|
4 |
class Location(BaseModel):
|
|
|
7 |
lon: float
|
8 |
relevance: str = Field(description="Why this location matters in the historical context")
|
9 |
|
10 |
+
class TemporalZoom(BaseModel):
|
11 |
+
level: str = Field(description="Level of temporal detail (century/decade/year)")
|
12 |
range: List[int] = Field(description="Start and end years for the time period")
|
13 |
explanation: str = Field(description="Historical significance of this time period")
|
14 |
|
15 |
+
class GeographicalZoom(BaseModel):
|
16 |
+
level: str = Field(description="Level of geographical detail (continent/country/city)")
|
17 |
+
locations: List[Location]
|
18 |
+
explanation: str = Field(description="Significance of these locations")
|
19 |
+
|
20 |
+
class StyleZoom(BaseModel):
|
21 |
level: str = Field(description="Level of style detail (movement/sub_movement/specific)")
|
22 |
options: List[str] = Field(description="Available artistic styles for selection")
|
23 |
explanation: str = Field(description="Historical context for the artistic styles")
|
24 |
|
25 |
+
class ZoomConfiguration(BaseModel):
|
26 |
+
in_zoom: Optional[Union[TemporalZoom, GeographicalZoom, StyleZoom]]
|
27 |
+
out_zoom: Optional[Union[TemporalZoom, GeographicalZoom, StyleZoom]]
|
28 |
|
29 |
class AxisImpact(BaseModel):
|
30 |
+
temporal: Optional[str] = Field(default=None, description="How time period affects this axis")
|
31 |
+
geographical: Optional[str] = Field(default=None, description="How location affects this axis")
|
32 |
+
style: Optional[str] = Field(default=None, description="How artistic style affects this axis")
|
33 |
+
|
34 |
+
class AxisConfiguration(BaseModel):
|
35 |
+
component: str
|
36 |
+
current_zoom: Union[TemporalZoom, GeographicalZoom, StyleZoom]
|
37 |
+
available_zooms: Optional[ZoomConfiguration] = None
|
38 |
+
impacted_by: Optional[AxisImpact] = None
|
39 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
class Analysis(BaseModel):
|
41 |
query_focus: str = Field(description="Main subject of the query")
|
42 |
historical_context: str = Field(description="Brief historical context")
|
43 |
|
44 |
class ArtHistoryResponse(BaseModel):
|
45 |
analysis: Analysis
|
46 |
+
axis_configurations: Dict[str, AxisConfiguration]
|
|