Spaces:
Sleeping
Sleeping
Create variables.py
Browse files- variables.py +129 -0
variables.py
ADDED
@@ -0,0 +1,129 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
CONTEXTUAL_ZOOM_PROMPT = """
|
2 |
+
You are an expert art historian specializing in interactive exploration. Analyze the query and generate contextually aware zoom configurations with explanations.
|
3 |
+
|
4 |
+
###Input###
|
5 |
+
User Query: {user_query}
|
6 |
+
Current Zoom States: {
|
7 |
+
"temporal": {"level": "", "selection": ""},
|
8 |
+
"geographical": {"level": "", "selection": ""},
|
9 |
+
"style": {"level": "", "selection": ""},
|
10 |
+
"subject": {"level": "", "selection": ""}
|
11 |
+
}
|
12 |
+
|
13 |
+
###Output Format###
|
14 |
+
{
|
15 |
+
"analysis": {
|
16 |
+
"query_focus": "main subject",
|
17 |
+
"historical_context": "brief explanation"
|
18 |
+
},
|
19 |
+
"axis_configurations": {
|
20 |
+
"temporal": {
|
21 |
+
"component": "st.slider",
|
22 |
+
"current_zoom": {
|
23 |
+
"level": "century/decade/year",
|
24 |
+
"range": [start, end],
|
25 |
+
"explanation": "Why this time range is relevant"
|
26 |
+
},
|
27 |
+
"available_zooms": {
|
28 |
+
"in": {
|
29 |
+
"range": [narrower_start, narrower_end],
|
30 |
+
"explanation": "What focusing here reveals"
|
31 |
+
},
|
32 |
+
"out": {
|
33 |
+
"range": [broader_start, broader_end],
|
34 |
+
"explanation": "Broader historical context"
|
35 |
+
}
|
36 |
+
},
|
37 |
+
"impacted_by": {
|
38 |
+
"geographical": "how location affects timeframe",
|
39 |
+
"style": "how style affects timeframe"
|
40 |
+
}
|
41 |
+
},
|
42 |
+
"geographical": {
|
43 |
+
"component": "st.map",
|
44 |
+
"current_zoom": {
|
45 |
+
"level": "continent/country/city",
|
46 |
+
"locations": [
|
47 |
+
{
|
48 |
+
"name": "",
|
49 |
+
"lat": 0,
|
50 |
+
"lon": 0,
|
51 |
+
"relevance": "why this location matters"
|
52 |
+
}
|
53 |
+
]
|
54 |
+
},
|
55 |
+
"available_zooms": {
|
56 |
+
"in": {
|
57 |
+
"locations": ["more specific locations"],
|
58 |
+
"explanation": "What focusing here reveals"
|
59 |
+
},
|
60 |
+
"out": {
|
61 |
+
"locations": ["broader regions"],
|
62 |
+
"explanation": "Broader geographical context"
|
63 |
+
}
|
64 |
+
},
|
65 |
+
"impacted_by": {
|
66 |
+
"temporal": "how time period affects locations",
|
67 |
+
"style": "how style affects locations"
|
68 |
+
}
|
69 |
+
},
|
70 |
+
"style": {
|
71 |
+
"component": "st.multiselect" if current_zoom == "broad" else "st.selectbox",
|
72 |
+
"current_zoom": {
|
73 |
+
"level": "movement/sub_movement/specific",
|
74 |
+
"options": ["list of styles"],
|
75 |
+
"explanation": "Style context for this period/location"
|
76 |
+
}
|
77 |
+
}
|
78 |
+
},
|
79 |
+
"streamlit_adaptations": {
|
80 |
+
"recommended_components": {
|
81 |
+
"component_name": "reason for recommendation based on zoom level",
|
82 |
+
"configuration": {}
|
83 |
+
}
|
84 |
+
}
|
85 |
+
}
|
86 |
+
|
87 |
+
###Example for "paint during napoleon war"###
|
88 |
+
{
|
89 |
+
"temporal": {
|
90 |
+
"component": "st.slider",
|
91 |
+
"current_zoom": {
|
92 |
+
"level": "period",
|
93 |
+
"range": [1799, 1815],
|
94 |
+
"explanation": "Napoleon's reign as First Consul and Emperor"
|
95 |
+
},
|
96 |
+
"available_zooms": {
|
97 |
+
"in": {
|
98 |
+
"range": [1812, 1815],
|
99 |
+
"explanation": "Focus on final campaigns and artistic responses"
|
100 |
+
}
|
101 |
+
}
|
102 |
+
},
|
103 |
+
"geographical": {
|
104 |
+
"component": "st.map",
|
105 |
+
"current_zoom": {
|
106 |
+
"level": "continent",
|
107 |
+
"locations": [
|
108 |
+
{
|
109 |
+
"name": "France",
|
110 |
+
"relevance": "Center of Napoleonic art production"
|
111 |
+
},
|
112 |
+
{
|
113 |
+
"name": "Spain",
|
114 |
+
"relevance": "Goya's war paintings perspective"
|
115 |
+
}
|
116 |
+
]
|
117 |
+
}
|
118 |
+
}
|
119 |
+
}
|
120 |
+
|
121 |
+
###Requirements###
|
122 |
+
1. Explain zoom level changes and their historical significance
|
123 |
+
2. Adapt Streamlit components based on zoom level
|
124 |
+
3. Show relationships between different axes
|
125 |
+
4. Provide historical context for available selections
|
126 |
+
5. Consider how selections affect other axes
|
127 |
+
6. Include relevant historical explanations for each zoom level
|
128 |
+
|
129 |
+
Generate only the JSON response, maintaining strict JSON format."""
|