Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -142,152 +142,6 @@ def ask_estella(message: str, history: list) -> str:
|
|
| 142 |
).strip()
|
| 143 |
|
| 144 |
|
| 145 |
-
THEME = gr.themes.Soft(
|
| 146 |
-
primary_hue="orange",
|
| 147 |
-
secondary_hue="amber",
|
| 148 |
-
neutral_hue="slate",
|
| 149 |
-
radius_size="lg",
|
| 150 |
-
spacing_size="sm",
|
| 151 |
-
)
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
CUSTOM_CSS = """
|
| 155 |
-
html,
|
| 156 |
-
body {
|
| 157 |
-
margin: 0 !important;
|
| 158 |
-
background: #fff8cc !important;
|
| 159 |
-
overflow-x: hidden !important;
|
| 160 |
-
overflow-y: auto !important;
|
| 161 |
-
}
|
| 162 |
-
|
| 163 |
-
.gradio-container {
|
| 164 |
-
min-height: 100dvh !important;
|
| 165 |
-
background: #fff8cc !important;
|
| 166 |
-
color: #1f2937 !important;
|
| 167 |
-
overflow: visible !important;
|
| 168 |
-
}
|
| 169 |
-
|
| 170 |
-
/* Prevent layout containers from forcing extra height */
|
| 171 |
-
.gradio-container .main,
|
| 172 |
-
.gradio-container .contain {
|
| 173 |
-
min-height: 0 !important;
|
| 174 |
-
}
|
| 175 |
-
|
| 176 |
-
.gradio-container .block,
|
| 177 |
-
.gradio-container .panel,
|
| 178 |
-
.gradio-container .form {
|
| 179 |
-
background-color: transparent !important;
|
| 180 |
-
}
|
| 181 |
-
|
| 182 |
-
/* Title */
|
| 183 |
-
.gradio-container h1 {
|
| 184 |
-
color: #78350f !important;
|
| 185 |
-
letter-spacing: -0.02em;
|
| 186 |
-
}
|
| 187 |
-
|
| 188 |
-
/* Readable text */
|
| 189 |
-
.gradio-container p,
|
| 190 |
-
.gradio-container label {
|
| 191 |
-
color: #1f2937 !important;
|
| 192 |
-
}
|
| 193 |
-
|
| 194 |
-
/* Black hyperlinks */
|
| 195 |
-
.gradio-container a,
|
| 196 |
-
.gradio-container a:visited,
|
| 197 |
-
.gradio-container a:hover,
|
| 198 |
-
.gradio-container a:active {
|
| 199 |
-
color: #111827 !important;
|
| 200 |
-
text-decoration: underline !important;
|
| 201 |
-
}
|
| 202 |
-
|
| 203 |
-
/*
|
| 204 |
-
Correct Gradio chat container.
|
| 205 |
-
This prevents the chat from expanding the entire page.
|
| 206 |
-
*/
|
| 207 |
-
.gradio-container .block.flex:has(
|
| 208 |
-
[role="log"][aria-label="chatbot conversation"]
|
| 209 |
-
) {
|
| 210 |
-
flex-grow: 0 !important;
|
| 211 |
-
height: min(400px, max(220px, calc(100dvh - 350px))) !important;
|
| 212 |
-
min-height: 220px !important;
|
| 213 |
-
overflow: hidden !important;
|
| 214 |
-
}
|
| 215 |
-
|
| 216 |
-
/* Make only the conversation area scroll */
|
| 217 |
-
.gradio-container [role="log"][aria-label="chatbot conversation"] {
|
| 218 |
-
height: 100% !important;
|
| 219 |
-
min-height: 0 !important;
|
| 220 |
-
max-height: none !important;
|
| 221 |
-
overflow-x: hidden !important;
|
| 222 |
-
overflow-y: auto !important;
|
| 223 |
-
}
|
| 224 |
-
|
| 225 |
-
/* User messages */
|
| 226 |
-
.gradio-container .message.user {
|
| 227 |
-
background: #fff0b8 !important;
|
| 228 |
-
border: 1px solid #f2c94c !important;
|
| 229 |
-
border-radius: 18px !important;
|
| 230 |
-
color: #1f2937 !important;
|
| 231 |
-
}
|
| 232 |
-
|
| 233 |
-
/* Estella messages */
|
| 234 |
-
.gradio-container .message.bot {
|
| 235 |
-
background: #fffdf0 !important;
|
| 236 |
-
border: 1px solid #e8dca3 !important;
|
| 237 |
-
border-radius: 18px !important;
|
| 238 |
-
color: #1f2937 !important;
|
| 239 |
-
}
|
| 240 |
-
|
| 241 |
-
/* Clearly highlighted input box */
|
| 242 |
-
.gradio-container textarea {
|
| 243 |
-
min-height: 54px !important;
|
| 244 |
-
border: 2px solid #e59b16 !important;
|
| 245 |
-
border-radius: 16px !important;
|
| 246 |
-
background: #fffdf0 !important;
|
| 247 |
-
color: #1f2937 !important;
|
| 248 |
-
}
|
| 249 |
-
|
| 250 |
-
.gradio-container textarea:focus {
|
| 251 |
-
border-color: #c2410c !important;
|
| 252 |
-
box-shadow: 0 0 0 4px rgba(194, 65, 12, 0.18) !important;
|
| 253 |
-
}
|
| 254 |
-
|
| 255 |
-
/* Submit button */
|
| 256 |
-
.gradio-container button.primary {
|
| 257 |
-
background: #d97706 !important;
|
| 258 |
-
border: none !important;
|
| 259 |
-
color: white !important;
|
| 260 |
-
border-radius: 14px !important;
|
| 261 |
-
font-weight: 700 !important;
|
| 262 |
-
}
|
| 263 |
-
|
| 264 |
-
.gradio-container button.primary:hover {
|
| 265 |
-
background: #b45309 !important;
|
| 266 |
-
}
|
| 267 |
-
|
| 268 |
-
/* Example buttons */
|
| 269 |
-
.gradio-container button.secondary {
|
| 270 |
-
border-color: #e5b94c !important;
|
| 271 |
-
color: #78350f !important;
|
| 272 |
-
}
|
| 273 |
-
|
| 274 |
-
/* Remove footer */
|
| 275 |
-
footer {
|
| 276 |
-
display: none !important;
|
| 277 |
-
}
|
| 278 |
-
|
| 279 |
-
/* Mobile layout */
|
| 280 |
-
@media (max-width: 640px) {
|
| 281 |
-
.gradio-container .block.flex:has(
|
| 282 |
-
[role="log"][aria-label="chatbot conversation"]
|
| 283 |
-
) {
|
| 284 |
-
height: 42dvh !important;
|
| 285 |
-
min-height: 180px !important;
|
| 286 |
-
}
|
| 287 |
-
}
|
| 288 |
-
"""
|
| 289 |
-
|
| 290 |
-
|
| 291 |
demo = gr.ChatInterface(
|
| 292 |
fn=ask_estella,
|
| 293 |
title="Estella Explainer Math Reading Coach",
|
|
@@ -307,7 +161,4 @@ demo = gr.ChatInterface(
|
|
| 307 |
|
| 308 |
|
| 309 |
if __name__ == "__main__":
|
| 310 |
-
demo.launch(
|
| 311 |
-
theme=THEME,
|
| 312 |
-
css=CUSTOM_CSS,
|
| 313 |
-
)
|
|
|
|
| 142 |
).strip()
|
| 143 |
|
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