Reality123b commited on
Commit
4406097
ยท
verified ยท
1 Parent(s): 0ff696c

Update app.py

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