phxdev commited on
Commit
d2df871
·
verified ·
1 Parent(s): b1e5fba

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +98 -152
app.py CHANGED
@@ -300,218 +300,170 @@ def main():
300
  gpu_placeholder()
301
  print("✅ Spaces compatibility enabled")
302
 
303
- # Clean, professional CSS that won't burn your retinas
304
- clean_css = """
305
- /* Reset and base styling */
306
  .gradio-container {
307
- max-width: 1400px !important;
308
  margin: 0 auto !important;
309
- background: #f8fafc !important;
310
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif !important;
311
- color: #1e293b !important;
 
312
  }
313
 
314
- /* Clean header */
315
  .header {
316
  background: #ffffff !important;
317
- border: 1px solid #e2e8f0 !important;
318
  border-radius: 8px !important;
319
  padding: 24px !important;
320
  margin-bottom: 24px !important;
321
- box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1) !important;
322
  }
323
 
324
  .header h1 {
325
- font-size: 28px !important;
326
  font-weight: 600 !important;
327
- color: #0f172a !important;
328
  margin: 0 0 8px 0 !important;
329
- display: flex !important;
330
- align-items: center !important;
331
- gap: 12px !important;
332
  }
333
 
334
  .header p {
335
  font-size: 16px !important;
336
- color: #64748b !important;
337
  margin: 0 !important;
338
- font-weight: 400 !important;
339
  }
340
 
341
- /* Model info card */
342
- .model-info {
343
- background: #f1f5f9 !important;
344
- border: 1px solid #cbd5e1 !important;
345
  border-radius: 6px !important;
346
  padding: 16px !important;
347
  margin: 16px 0 !important;
348
- font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace !important;
349
  font-size: 14px !important;
350
- line-height: 1.6 !important;
351
- color: #334155 !important;
352
  }
353
 
354
- /* Status indicators */
355
- .status-good {
356
- background: #f0fdf4 !important;
357
- border: 1px solid #bbf7d0 !important;
358
- color: #166534 !important;
359
  border-radius: 6px !important;
360
  padding: 12px 16px !important;
361
  margin: 16px 0 !important;
362
- font-size: 14px !important;
363
  font-weight: 500 !important;
364
  }
365
 
366
- /* Chat interface */
367
- .chat-container {
368
  background: #ffffff !important;
369
- border: 1px solid #e2e8f0 !important;
370
  border-radius: 8px !important;
371
- overflow: hidden !important;
372
- box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1) !important;
373
- }
374
-
375
- /* Input styling */
376
- .input-row {
377
- background: #ffffff !important;
378
- border: 1px solid #e2e8f0 !important;
379
- border-radius: 8px !important;
380
- margin-top: 16px !important;
381
  overflow: hidden !important;
382
  }
383
 
384
  /* Tools section */
385
- .tools-section {
386
  background: #ffffff !important;
387
- border: 1px solid #e2e8f0 !important;
388
  border-radius: 8px !important;
389
  padding: 24px !important;
390
  margin: 24px 0 !important;
391
- box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1) !important;
392
  }
393
 
394
  .tools-title {
395
- font-size: 18px !important;
396
  font-weight: 600 !important;
397
- color: #0f172a !important;
398
- margin: 0 0 20px 0 !important;
399
- border-bottom: 1px solid #e2e8f0 !important;
400
- padding-bottom: 12px !important;
401
- }
402
-
403
- /* Button styling */
404
- .btn-primary {
405
- background: #3b82f6 !important;
406
- color: white !important;
407
- border: none !important;
408
- border-radius: 6px !important;
409
- padding: 8px 16px !important;
410
- font-weight: 500 !important;
411
- font-size: 14px !important;
412
- transition: all 0.2s ease !important;
413
- box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05) !important;
414
- }
415
-
416
- .btn-primary:hover {
417
- background: #2563eb !important;
418
- box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.1) !important;
419
  }
420
 
421
- /* Form elements */
422
- .gradio-textbox {
423
- border: 1px solid #d1d5db !important;
424
- border-radius: 6px !important;
425
  background: #ffffff !important;
 
426
  color: #111827 !important;
427
- font-size: 14px !important;
 
428
  }
429
 
430
- .gradio-textbox:focus {
 
431
  border-color: #3b82f6 !important;
 
432
  box-shadow: 0 0 0 1px #3b82f6 !important;
433
  }
434
 
435
- /* Labels */
436
- .gradio-label {
437
  color: #374151 !important;
438
  font-weight: 500 !important;
439
  font-size: 14px !important;
440
- margin-bottom: 6px !important;
 
441
  }
442
 
443
- /* Examples */
444
- .examples-container {
445
- background: #f9fafb !important;
446
- border: 1px solid #e5e7eb !important;
447
- border-radius: 6px !important;
448
- padding: 12px !important;
449
- margin: 12px 0 !important;
 
 
 
 
 
 
 
 
 
 
 
 
450
  }
451
 
452
  /* Footer */
453
  .footer {
454
  text-align: center !important;
455
- padding: 32px 24px !important;
456
  color: #6b7280 !important;
457
- background: #ffffff !important;
458
- border: 1px solid #e2e8f0 !important;
459
- border-radius: 8px !important;
460
  margin-top: 32px !important;
461
- font-size: 14px !important;
462
- line-height: 1.6 !important;
463
  }
464
 
465
- /* Remove excessive spacing */
466
- .gradio-container .block {
467
- margin: 0 !important;
468
- padding: 0 !important;
469
  }
470
 
471
- /* Clean up default gradio styling */
472
  .gradio-container .prose {
 
473
  max-width: none !important;
474
- color: inherit !important;
475
  }
476
 
477
  .gradio-container .prose h1,
478
  .gradio-container .prose h2,
479
- .gradio-container .prose h3 {
480
- color: inherit !important;
 
481
  }
482
 
483
- /* Dark mode support */
484
  @media (prefers-color-scheme: dark) {
 
485
  .gradio-container {
486
- background: #0f172a !important;
487
- color: #e2e8f0 !important;
488
- }
489
-
490
- .header, .chat-container, .tools-section, .input-row, .footer {
491
- background: #1e293b !important;
492
- border-color: #334155 !important;
493
- }
494
-
495
- .header h1 {
496
- color: #f1f5f9 !important;
497
- }
498
-
499
- .model-info {
500
- background: #334155 !important;
501
- border-color: #475569 !important;
502
- color: #cbd5e1 !important;
503
- }
504
-
505
- .status-good {
506
- background: #064e3b !important;
507
- border-color: #065f46 !important;
508
- color: #a7f3d0 !important;
509
- }
510
-
511
- .gradio-textbox {
512
- background: #334155 !important;
513
- border-color: #475569 !important;
514
- color: #e2e8f0 !important;
515
  }
516
  }
517
  """
@@ -519,7 +471,7 @@ def main():
519
  # Create the interface
520
  with gr.Blocks(
521
  title="🎸 Creed Bratton AI",
522
- css=clean_css,
523
  theme=gr.themes.Default()
524
  ) as demo:
525
 
@@ -533,7 +485,7 @@ def main():
533
 
534
  # Model info
535
  gr.HTML("""
536
- <div class="model-info">
537
  <strong>Model:</strong> phxdev/creed-qwen-0.5b-lora<br>
538
  <strong>Base:</strong> Qwen 0.5B + LoRA fine-tuning<br>
539
  <strong>Tokens:</strong> &lt;thinking&gt;, &lt;conspiracy&gt;, &lt;tangent&gt;
@@ -543,13 +495,13 @@ def main():
543
  # MCP status
544
  if os.environ.get('GRADIO_MCP_ENABLED'):
545
  gr.HTML("""
546
- <div class="status-good">
547
  ✓ MCP Server Active • Available as tool for Claude Desktop
548
  </div>
549
  """)
550
 
551
  # Main chat interface
552
- with gr.Row(elem_classes="chat-container"):
553
  chatbot = gr.Chatbot(
554
  type='messages',
555
  height=550,
@@ -562,46 +514,40 @@ def main():
562
  )
563
 
564
  # Input
565
- with gr.Row(elem_classes="input-row"):
566
- msg = gr.Textbox(
567
- placeholder="Ask Creed anything...",
568
- container=False,
569
- scale=7,
570
- submit_btn=True,
571
- stop_btn=True,
572
- elem_classes="gradio-textbox"
573
- )
574
 
575
  # MCP Tools section
576
- with gr.Row(elem_classes="tools-section"):
577
  gr.HTML('<div class="tools-title">🛠️ MCP Tools</div>')
578
 
579
  with gr.Row():
580
  with gr.Column():
581
  wisdom_topic = gr.Textbox(
582
  label="Wisdom Topic",
583
- placeholder="life, business, relationships...",
584
- elem_classes="gradio-textbox"
585
  )
586
  wisdom_output = gr.Textbox(
587
  label="Creed's Response",
588
- interactive=False,
589
- elem_classes="gradio-textbox"
590
  )
591
- wisdom_btn = gr.Button("Ask Creed", variant="primary", elem_classes="btn-primary")
592
 
593
  with gr.Column():
594
  story_situation = gr.Textbox(
595
  label="Story Request",
596
- placeholder="Tell me about...",
597
- elem_classes="gradio-textbox"
598
  )
599
  story_output = gr.Textbox(
600
  label="Creed's Story",
601
- interactive=False,
602
- elem_classes="gradio-textbox"
603
  )
604
- story_btn = gr.Button("Get Story", variant="primary", elem_classes="btn-primary")
605
 
606
  # Wire up the tools
607
  wisdom_btn.click(
 
300
  gpu_placeholder()
301
  print("✅ Spaces compatibility enabled")
302
 
303
+ # Simple, readable CSS that actually works
304
+ simple_css = """
305
+ /* Basic reset */
306
  .gradio-container {
307
+ max-width: 1200px !important;
308
  margin: 0 auto !important;
309
+ background: #ffffff !important;
310
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif !important;
311
+ color: #1f2937 !important;
312
+ padding: 20px !important;
313
  }
314
 
315
+ /* Header */
316
  .header {
317
  background: #ffffff !important;
318
+ border: 2px solid #e5e7eb !important;
319
  border-radius: 8px !important;
320
  padding: 24px !important;
321
  margin-bottom: 24px !important;
322
+ text-align: center !important;
323
  }
324
 
325
  .header h1 {
326
+ font-size: 32px !important;
327
  font-weight: 600 !important;
328
+ color: #111827 !important;
329
  margin: 0 0 8px 0 !important;
 
 
 
330
  }
331
 
332
  .header p {
333
  font-size: 16px !important;
334
+ color: #6b7280 !important;
335
  margin: 0 !important;
 
336
  }
337
 
338
+ /* Info boxes */
339
+ .info-box {
340
+ background: #f9fafb !important;
341
+ border: 1px solid #d1d5db !important;
342
  border-radius: 6px !important;
343
  padding: 16px !important;
344
  margin: 16px 0 !important;
345
+ color: #374151 !important;
346
  font-size: 14px !important;
347
+ line-height: 1.5 !important;
 
348
  }
349
 
350
+ .status-box {
351
+ background: #ecfdf5 !important;
352
+ border: 1px solid #a7f3d0 !important;
 
 
353
  border-radius: 6px !important;
354
  padding: 12px 16px !important;
355
  margin: 16px 0 !important;
356
+ color: #065f46 !important;
357
  font-weight: 500 !important;
358
  }
359
 
360
+ /* Chat area */
361
+ .chat-area {
362
  background: #ffffff !important;
363
+ border: 2px solid #e5e7eb !important;
364
  border-radius: 8px !important;
365
+ margin: 16px 0 !important;
 
 
 
 
 
 
 
 
 
366
  overflow: hidden !important;
367
  }
368
 
369
  /* Tools section */
370
+ .tools-area {
371
  background: #ffffff !important;
372
+ border: 2px solid #e5e7eb !important;
373
  border-radius: 8px !important;
374
  padding: 24px !important;
375
  margin: 24px 0 !important;
 
376
  }
377
 
378
  .tools-title {
379
+ font-size: 20px !important;
380
  font-weight: 600 !important;
381
+ color: #111827 !important;
382
+ margin: 0 0 16px 0 !important;
383
+ padding-bottom: 8px !important;
384
+ border-bottom: 1px solid #e5e7eb !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
385
  }
386
 
387
+ /* Form elements - force readable colors */
388
+ .gradio-textbox input,
389
+ .gradio-textbox textarea {
 
390
  background: #ffffff !important;
391
+ border: 1px solid #d1d5db !important;
392
  color: #111827 !important;
393
+ border-radius: 4px !important;
394
+ padding: 8px 12px !important;
395
  }
396
 
397
+ .gradio-textbox input:focus,
398
+ .gradio-textbox textarea:focus {
399
  border-color: #3b82f6 !important;
400
+ outline: none !important;
401
  box-shadow: 0 0 0 1px #3b82f6 !important;
402
  }
403
 
404
+ /* Labels - force readable */
405
+ .gradio-container label {
406
  color: #374151 !important;
407
  font-weight: 500 !important;
408
  font-size: 14px !important;
409
+ margin-bottom: 4px !important;
410
+ display: block !important;
411
  }
412
 
413
+ /* Buttons */
414
+ .gradio-container button {
415
+ background: #3b82f6 !important;
416
+ color: #ffffff !important;
417
+ border: none !important;
418
+ border-radius: 4px !important;
419
+ padding: 8px 16px !important;
420
+ font-weight: 500 !important;
421
+ cursor: pointer !important;
422
+ }
423
+
424
+ .gradio-container button:hover {
425
+ background: #2563eb !important;
426
+ }
427
+
428
+ /* Chat messages - ensure readability */
429
+ .message {
430
+ color: #111827 !important;
431
+ background: #ffffff !important;
432
  }
433
 
434
  /* Footer */
435
  .footer {
436
  text-align: center !important;
437
+ padding: 24px !important;
438
  color: #6b7280 !important;
439
+ border-top: 1px solid #e5e7eb !important;
 
 
440
  margin-top: 32px !important;
441
+ background: #ffffff !important;
 
442
  }
443
 
444
+ /* Force text to be readable everywhere */
445
+ .gradio-container * {
446
+ color: inherit !important;
 
447
  }
448
 
 
449
  .gradio-container .prose {
450
+ color: #111827 !important;
451
  max-width: none !important;
 
452
  }
453
 
454
  .gradio-container .prose h1,
455
  .gradio-container .prose h2,
456
+ .gradio-container .prose h3,
457
+ .gradio-container .prose p {
458
+ color: #111827 !important;
459
  }
460
 
461
+ /* Remove any dark mode for now */
462
  @media (prefers-color-scheme: dark) {
463
+ /* Override dark mode completely */
464
  .gradio-container {
465
+ background: #ffffff !important;
466
+ color: #1f2937 !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
467
  }
468
  }
469
  """
 
471
  # Create the interface
472
  with gr.Blocks(
473
  title="🎸 Creed Bratton AI",
474
+ css=simple_css,
475
  theme=gr.themes.Default()
476
  ) as demo:
477
 
 
485
 
486
  # Model info
487
  gr.HTML("""
488
+ <div class="info-box">
489
  <strong>Model:</strong> phxdev/creed-qwen-0.5b-lora<br>
490
  <strong>Base:</strong> Qwen 0.5B + LoRA fine-tuning<br>
491
  <strong>Tokens:</strong> &lt;thinking&gt;, &lt;conspiracy&gt;, &lt;tangent&gt;
 
495
  # MCP status
496
  if os.environ.get('GRADIO_MCP_ENABLED'):
497
  gr.HTML("""
498
+ <div class="status-box">
499
  ✓ MCP Server Active • Available as tool for Claude Desktop
500
  </div>
501
  """)
502
 
503
  # Main chat interface
504
+ with gr.Row(elem_classes="chat-area"):
505
  chatbot = gr.Chatbot(
506
  type='messages',
507
  height=550,
 
514
  )
515
 
516
  # Input
517
+ msg = gr.Textbox(
518
+ placeholder="Ask Creed anything...",
519
+ container=False,
520
+ scale=7,
521
+ submit_btn=True,
522
+ stop_btn=True
523
+ )
 
 
524
 
525
  # MCP Tools section
526
+ with gr.Row(elem_classes="tools-area"):
527
  gr.HTML('<div class="tools-title">🛠️ MCP Tools</div>')
528
 
529
  with gr.Row():
530
  with gr.Column():
531
  wisdom_topic = gr.Textbox(
532
  label="Wisdom Topic",
533
+ placeholder="life, business, relationships..."
 
534
  )
535
  wisdom_output = gr.Textbox(
536
  label="Creed's Response",
537
+ interactive=False
 
538
  )
539
+ wisdom_btn = gr.Button("Ask Creed", variant="primary")
540
 
541
  with gr.Column():
542
  story_situation = gr.Textbox(
543
  label="Story Request",
544
+ placeholder="Tell me about..."
 
545
  )
546
  story_output = gr.Textbox(
547
  label="Creed's Story",
548
+ interactive=False
 
549
  )
550
+ story_btn = gr.Button("Get Story", variant="primary")
551
 
552
  # Wire up the tools
553
  wisdom_btn.click(