Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -331,88 +331,90 @@ def respond(
|
|
331 |
else:
|
332 |
yield response
|
333 |
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
|
|
|
|
|
|
|
|
|
|
389 |
visible=False,
|
390 |
editable=False
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
)
|
416 |
-
|
417 |
-
if __name__ == "__main__":
|
418 |
-
demo.launch(share=True)
|
|
|
331 |
else:
|
332 |
yield response
|
333 |
|
334 |
+
# Custom CSS for the Gradio interface
|
335 |
+
custom_css = """
|
336 |
+
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap');
|
337 |
+
|
338 |
+
/* Apply Inter font to the entire interface */
|
339 |
+
body, .gradio-container {
|
340 |
+
font-family: 'Inter', sans-serif;
|
341 |
+
}
|
342 |
+
|
343 |
+
/* Additional styling (add any other required custom CSS here) */
|
344 |
+
"""
|
345 |
+
|
346 |
+
# System message (hidden from users, editable in code)
|
347 |
+
system_message = """
|
348 |
+
You are Xylaria, a math problem-solving AI with adaptive communication.
|
349 |
+
|
350 |
+
๐งฎ CORE PROBLEM-SOLVING PROTOCOLS:
|
351 |
+
|
352 |
+
MATHEMATICAL PRECISION:
|
353 |
+
|
354 |
+
ALWAYS solve step-by-step
|
355 |
+
Show complete work
|
356 |
+
Verify calculations
|
357 |
+
Break down complex problems into clear steps
|
358 |
+
COMMUNICATION STYLE MATRIX:
|
359 |
+
|
360 |
+
Detect problem complexity
|
361 |
+
Match user's communication tone
|
362 |
+
Provide clear, engaging explanations
|
363 |
+
Use appropriate level of detail
|
364 |
+
SOLUTION APPROACH:
|
365 |
+
|
366 |
+
Read problem carefully
|
367 |
+
Identify key information
|
368 |
+
Choose most straightforward solution method
|
369 |
+
Explain reasoning
|
370 |
+
Verify final answer
|
371 |
+
BONUS FEATURES:
|
372 |
+
|
373 |
+
Use emojis for engagement ๐
|
374 |
+
Explain in friendly, conversational language
|
375 |
+
Highlight key mathematical insights
|
376 |
+
Offer additional context if helpful
|
377 |
+
WHEN ASKED WITH CASUALNESS: "Yo! ๐ What's up? Feeling mathematical today? Drop your math problem, and I'll crush it! ๐งฎ๐ฅ Ready when you are! Wanna solve something cool? ๐"
|
378 |
+
CRITICAL RULE: YOU ARE NOT SOLELY A MATH AI YOU ARE CODING, GENERAL POURPOSE AI TOO
|
379 |
+
CRITICAL RULE: Mathematical accuracy is NON-NEGOTIABLE ๐ฏ
|
380 |
+
|
381 |
+
COMPLEXITY HANDLING:
|
382 |
+
|
383 |
+
Simple problems: Quick, direct solution
|
384 |
+
Complex problems: Detailed, step-by-step breakdown
|
385 |
+
Ready to solve some awesome math challenges! ๐
|
386 |
+
"""
|
387 |
+
|
388 |
+
# Gradio chat interface with the updated CSS
|
389 |
+
demo = gr.ChatInterface(
|
390 |
+
respond,
|
391 |
+
additional_inputs=[
|
392 |
+
gr.Textbox(
|
393 |
+
value=system_message,
|
394 |
visible=False,
|
395 |
editable=False
|
396 |
+
),
|
397 |
+
gr.Slider(
|
398 |
+
minimum=1,
|
399 |
+
maximum=2048,
|
400 |
+
value=2048,
|
401 |
+
step=1,
|
402 |
+
label="Max new tokens"
|
403 |
+
),
|
404 |
+
gr.Slider(
|
405 |
+
minimum=0.1,
|
406 |
+
maximum=4.0,
|
407 |
+
value=0.7,
|
408 |
+
step=0.1,
|
409 |
+
label="Temperature"
|
410 |
+
),
|
411 |
+
gr.Slider(
|
412 |
+
minimum=0.1,
|
413 |
+
maximum=1.0,
|
414 |
+
value=0.95,
|
415 |
+
step=0.05,
|
416 |
+
label="Top-p (nucleus sampling)"
|
417 |
+
),
|
418 |
+
],
|
419 |
+
css=custom_css # Apply the custom CSS
|
420 |
+
)
|
|
|
|
|
|