AlBaraa63 commited on
Commit
be62ad7
Β·
1 Parent(s): 32dc112

Enhance mobile responsiveness and improve UI elements in Gradio interface

Browse files
Files changed (1) hide show
  1. app.py +201 -24
app.py CHANGED
@@ -309,10 +309,23 @@ def load_sample_json():
309
  custom_css = """
310
  @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
311
 
 
 
 
 
 
 
 
 
 
 
312
  .gradio-container {
313
  font-family: 'Inter', sans-serif !important;
314
  max-width: 1400px !important;
315
  margin: 0 auto !important;
 
 
 
316
  }
317
 
318
  /* Header styling */
@@ -327,6 +340,21 @@ custom_css = """
327
  margin-bottom: 0.5em;
328
  }
329
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
330
  /* Tab styling */
331
  .tab-nav {
332
  border-radius: 12px !important;
@@ -343,6 +371,14 @@ button.selected {
343
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4) !important;
344
  }
345
 
 
 
 
 
 
 
 
 
346
  /* Button styling */
347
  .primary-btn {
348
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
@@ -361,6 +397,15 @@ button.selected {
361
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6) !important;
362
  }
363
 
 
 
 
 
 
 
 
 
 
364
  /* Input fields */
365
  textarea, input[type="text"] {
366
  border-radius: 10px !important;
@@ -375,6 +420,14 @@ textarea:focus, input[type="text"]:focus {
375
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1) !important;
376
  }
377
 
 
 
 
 
 
 
 
 
378
  /* Output boxes */
379
  .output-class {
380
  background: linear-gradient(to bottom, #ffffff, #f8f9fa) !important;
@@ -438,18 +491,142 @@ label {
438
  border-color: #764ba2 !important;
439
  background: #f8f9fa !important;
440
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
441
  """
442
 
443
  # Create Gradio interface
444
  with gr.Blocks(theme=gr.themes.Soft(), css=custom_css, title="MissionControlMCP Demo") as demo:
445
 
 
 
 
446
  gr.Markdown("# πŸš€ MissionControlMCP")
447
  gr.Markdown("### Enterprise Automation Tools - Powered by AI")
448
 
449
  gr.HTML("""
450
  <div style="text-align: center; padding: 20px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); border-radius: 15px; color: white; margin-bottom: 30px;">
451
- <h3 style="color: white; margin: 0;">✨ Try all 8 powerful tools in your browser - No installation needed! ✨</h3>
452
- <p style="margin: 10px 0 0 0; opacity: 0.9;">Built for HuggingFace Gradio Hackathon | Claude MCP Integration</p>
453
  </div>
454
  """)
455
 
@@ -830,55 +1007,55 @@ with gr.Blocks(theme=gr.themes.Soft(), css=custom_css, title="MissionControlMCP
830
  # Footer
831
  gr.HTML("""
832
  <div class="footer">
833
- <h2 style="margin-bottom: 20px;">🎯 About MissionControlMCP</h2>
834
 
835
- <p style="font-size: 18px; margin-bottom: 20px;">
836
  <strong>8 enterprise-grade automation tools</strong> integrated with Claude Desktop via Model Context Protocol (MCP)
837
  </p>
838
 
839
- <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 15px; margin: 30px 0;">
840
  <div style="padding: 15px; background: white; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.1);">
841
- <strong>πŸ“„ PDF Reader</strong><br/>
842
- <small>Extract text from documents</small>
843
  </div>
844
  <div style="padding: 15px; background: white; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.1);">
845
- <strong>πŸ“ Text Extractor</strong><br/>
846
- <small>Keywords & summaries</small>
847
  </div>
848
  <div style="padding: 15px; background: white; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.1);">
849
- <strong>🌐 Web Fetcher</strong><br/>
850
- <small>Scrape websites</small>
851
  </div>
852
  <div style="padding: 15px; background: white; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.1);">
853
- <strong>πŸ” RAG Search</strong><br/>
854
- <small>Semantic search</small>
855
  </div>
856
  <div style="padding: 15px; background: white; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.1);">
857
- <strong>πŸ“Š Data Visualizer</strong><br/>
858
- <small>Create charts</small>
859
  </div>
860
  <div style="padding: 15px; background: white; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.1);">
861
- <strong>πŸ”„ File Converter</strong><br/>
862
- <small>Format conversions</small>
863
  </div>
864
  <div style="padding: 15px; background: white; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.1);">
865
- <strong>πŸ“§ Email Classifier</strong><br/>
866
- <small>Intent detection</small>
867
  </div>
868
  <div style="padding: 15px; background: white; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.1);">
869
- <strong>πŸ“ˆ KPI Generator</strong><br/>
870
- <small>Business analytics</small>
871
  </div>
872
  </div>
873
 
874
  <div style="margin-top: 30px; padding-top: 20px; border-top: 2px solid #e9ecef;">
875
- <p style="font-size: 16px; margin: 10px 0;">
876
  πŸ”— <a href="https://github.com/AlBaraa-1/CleanEye-Hackathon" target="_blank" style="color: #667eea; text-decoration: none; font-weight: 600;">View on GitHub</a>
877
  </p>
878
- <p style="margin: 10px 0; color: #6c757d;">
879
  πŸ† Built for HuggingFace Gradio x BuildWithMCP Hackathon
880
  </p>
881
- <p style="margin: 10px 0; color: #6c757d;">
882
  Made with ❀️ using Python, Gradio, Claude MCP, FAISS, and Sentence Transformers
883
  </p>
884
  </div>
 
309
  custom_css = """
310
  @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
311
 
312
+ /* Global mobile-first settings */
313
+ * {
314
+ box-sizing: border-box !important;
315
+ }
316
+
317
+ html, body {
318
+ overflow-x: hidden !important;
319
+ width: 100% !important;
320
+ }
321
+
322
  .gradio-container {
323
  font-family: 'Inter', sans-serif !important;
324
  max-width: 1400px !important;
325
  margin: 0 auto !important;
326
+ padding: 10px !important;
327
+ width: 100% !important;
328
+ overflow-x: hidden !important;
329
  }
330
 
331
  /* Header styling */
 
340
  margin-bottom: 0.5em;
341
  }
342
 
343
+ /* Mobile responsive header */
344
+ @media (max-width: 768px) {
345
+ .gradio-container h1 {
346
+ font-size: 2em !important;
347
+ }
348
+
349
+ .gradio-container h3 {
350
+ font-size: 1.2em !important;
351
+ }
352
+
353
+ .gradio-container p {
354
+ font-size: 0.9em !important;
355
+ }
356
+ }
357
+
358
  /* Tab styling */
359
  .tab-nav {
360
  border-radius: 12px !important;
 
371
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4) !important;
372
  }
373
 
374
+ /* Mobile tab styling */
375
+ @media (max-width: 768px) {
376
+ .tab-nav button {
377
+ font-size: 0.85em !important;
378
+ padding: 8px 12px !important;
379
+ }
380
+ }
381
+
382
  /* Button styling */
383
  .primary-btn {
384
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
 
397
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6) !important;
398
  }
399
 
400
+ /* Mobile button styling */
401
+ @media (max-width: 768px) {
402
+ .primary-btn {
403
+ width: 100% !important;
404
+ padding: 14px 20px !important;
405
+ font-size: 15px !important;
406
+ }
407
+ }
408
+
409
  /* Input fields */
410
  textarea, input[type="text"] {
411
  border-radius: 10px !important;
 
420
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1) !important;
421
  }
422
 
423
+ /* Mobile input fields */
424
+ @media (max-width: 768px) {
425
+ textarea, input[type="text"] {
426
+ font-size: 16px !important;
427
+ padding: 10px !important;
428
+ }
429
+ }
430
+
431
  /* Output boxes */
432
  .output-class {
433
  background: linear-gradient(to bottom, #ffffff, #f8f9fa) !important;
 
491
  border-color: #764ba2 !important;
492
  background: #f8f9fa !important;
493
  }
494
+
495
+ /* Mobile responsive layout */
496
+ @media (max-width: 768px) {
497
+ .gr-row {
498
+ flex-direction: column !important;
499
+ gap: 15px !important;
500
+ }
501
+
502
+ .gr-column {
503
+ width: 100% !important;
504
+ max-width: 100% !important;
505
+ min-width: 0 !important;
506
+ flex: 0 0 100% !important;
507
+ }
508
+
509
+ .gr-file {
510
+ padding: 20px !important;
511
+ }
512
+
513
+ /* Stack columns vertically on mobile */
514
+ .gradio-container .gr-form {
515
+ display: flex !important;
516
+ flex-direction: column !important;
517
+ }
518
+
519
+ /* Prevent text overflow */
520
+ .gradio-container {
521
+ word-wrap: break-word !important;
522
+ overflow-wrap: break-word !important;
523
+ }
524
+
525
+ /* Better spacing on mobile */
526
+ .gr-box {
527
+ margin: 10px 0 !important;
528
+ }
529
+
530
+ /* Tabs scrollable on mobile */
531
+ .tab-nav {
532
+ overflow-x: auto !important;
533
+ -webkit-overflow-scrolling: touch !important;
534
+ white-space: nowrap !important;
535
+ }
536
+ }
537
+
538
+ /* Improve touch targets for mobile */
539
+ @media (max-width: 768px) {
540
+ button, a, input, textarea, select {
541
+ min-height: 44px !important;
542
+ -webkit-tap-highlight-color: rgba(102, 126, 234, 0.2) !important;
543
+ }
544
+
545
+ label {
546
+ font-size: 15px !important;
547
+ margin-bottom: 10px !important;
548
+ }
549
+
550
+ /* Better radio and checkbox sizing */
551
+ .gr-radio label, .gr-checkbox label {
552
+ padding: 12px !important;
553
+ min-height: 44px !important;
554
+ display: flex !important;
555
+ align-items: center !important;
556
+ }
557
+
558
+ /* Mobile-friendly sliders */
559
+ input[type="range"] {
560
+ height: 44px !important;
561
+ padding: 10px 0 !important;
562
+ }
563
+
564
+ /* Examples section */
565
+ .gr-samples-table {
566
+ overflow-x: auto !important;
567
+ -webkit-overflow-scrolling: touch !important;
568
+ }
569
+ }
570
+
571
+ /* Footer responsive */
572
+ @media (max-width: 768px) {
573
+ .footer {
574
+ padding: 20px 10px !important;
575
+ }
576
+
577
+ .footer h2 {
578
+ font-size: 1.5em !important;
579
+ }
580
+
581
+ .footer p {
582
+ font-size: 0.9em !important;
583
+ }
584
+ }
585
+
586
+ /* Smaller screens (phones in portrait) */
587
+ @media (max-width: 480px) {
588
+ .gradio-container h1 {
589
+ font-size: 1.5em !important;
590
+ }
591
+
592
+ .tab-nav button {
593
+ font-size: 0.75em !important;
594
+ padding: 6px 10px !important;
595
+ }
596
+
597
+ .primary-btn {
598
+ font-size: 14px !important;
599
+ padding: 12px 16px !important;
600
+ }
601
+
602
+ /* Reduce line count for better mobile UX */
603
+ textarea {
604
+ min-height: 100px !important;
605
+ }
606
+ }
607
+
608
+ /* Landscape mobile */
609
+ @media (max-width: 768px) and (orientation: landscape) {
610
+ .gradio-container h1 {
611
+ font-size: 1.8em !important;
612
+ margin-bottom: 0.3em !important;
613
+ }
614
+ }
615
  """
616
 
617
  # Create Gradio interface
618
  with gr.Blocks(theme=gr.themes.Soft(), css=custom_css, title="MissionControlMCP Demo") as demo:
619
 
620
+ # Add viewport meta tag for proper mobile rendering
621
+ gr.HTML("""<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0, user-scalable=yes">""")
622
+
623
  gr.Markdown("# πŸš€ MissionControlMCP")
624
  gr.Markdown("### Enterprise Automation Tools - Powered by AI")
625
 
626
  gr.HTML("""
627
  <div style="text-align: center; padding: 20px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); border-radius: 15px; color: white; margin-bottom: 30px;">
628
+ <h3 style="color: white; margin: 0; font-size: clamp(1rem, 4vw, 1.5rem);">✨ Try all 8 powerful tools in your browser - No installation needed! ✨</h3>
629
+ <p style="margin: 10px 0 0 0; opacity: 0.9; font-size: clamp(0.8rem, 3vw, 1rem);">Built for HuggingFace Gradio Hackathon | Claude MCP Integration</p>
630
  </div>
631
  """)
632
 
 
1007
  # Footer
1008
  gr.HTML("""
1009
  <div class="footer">
1010
+ <h2 style="margin-bottom: 20px; font-size: clamp(1.2rem, 5vw, 2rem);">🎯 About MissionControlMCP</h2>
1011
 
1012
+ <p style="font-size: clamp(0.9rem, 3vw, 1.125rem); margin-bottom: 20px;">
1013
  <strong>8 enterprise-grade automation tools</strong> integrated with Claude Desktop via Model Context Protocol (MCP)
1014
  </p>
1015
 
1016
+ <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 15px; margin: 30px 0;">
1017
  <div style="padding: 15px; background: white; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.1);">
1018
+ <strong style="font-size: clamp(0.85rem, 2.5vw, 1rem);">πŸ“„ PDF Reader</strong><br/>
1019
+ <small style="font-size: clamp(0.7rem, 2vw, 0.875rem);">Extract text from documents</small>
1020
  </div>
1021
  <div style="padding: 15px; background: white; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.1);">
1022
+ <strong style="font-size: clamp(0.85rem, 2.5vw, 1rem);">πŸ“ Text Extractor</strong><br/>
1023
+ <small style="font-size: clamp(0.7rem, 2vw, 0.875rem);">Keywords & summaries</small>
1024
  </div>
1025
  <div style="padding: 15px; background: white; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.1);">
1026
+ <strong style="font-size: clamp(0.85rem, 2.5vw, 1rem);">🌐 Web Fetcher</strong><br/>
1027
+ <small style="font-size: clamp(0.7rem, 2vw, 0.875rem);">Scrape websites</small>
1028
  </div>
1029
  <div style="padding: 15px; background: white; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.1);">
1030
+ <strong style="font-size: clamp(0.85rem, 2.5vw, 1rem);">πŸ” RAG Search</strong><br/>
1031
+ <small style="font-size: clamp(0.7rem, 2vw, 0.875rem);">Semantic search</small>
1032
  </div>
1033
  <div style="padding: 15px; background: white; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.1);">
1034
+ <strong style="font-size: clamp(0.85rem, 2.5vw, 1rem);">πŸ“Š Data Visualizer</strong><br/>
1035
+ <small style="font-size: clamp(0.7rem, 2vw, 0.875rem);">Create charts</small>
1036
  </div>
1037
  <div style="padding: 15px; background: white; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.1);">
1038
+ <strong style="font-size: clamp(0.85rem, 2.5vw, 1rem);">πŸ”„ File Converter</strong><br/>
1039
+ <small style="font-size: clamp(0.7rem, 2vw, 0.875rem);">Format conversions</small>
1040
  </div>
1041
  <div style="padding: 15px; background: white; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.1);">
1042
+ <strong style="font-size: clamp(0.85rem, 2.5vw, 1rem);">πŸ“§ Email Classifier</strong><br/>
1043
+ <small style="font-size: clamp(0.7rem, 2vw, 0.875rem);">Intent detection</small>
1044
  </div>
1045
  <div style="padding: 15px; background: white; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.1);">
1046
+ <strong style="font-size: clamp(0.85rem, 2.5vw, 1rem);">πŸ“ˆ KPI Generator</strong><br/>
1047
+ <small style="font-size: clamp(0.7rem, 2vw, 0.875rem);">Business analytics</small>
1048
  </div>
1049
  </div>
1050
 
1051
  <div style="margin-top: 30px; padding-top: 20px; border-top: 2px solid #e9ecef;">
1052
+ <p style="font-size: clamp(0.85rem, 2.5vw, 1rem); margin: 10px 0;">
1053
  πŸ”— <a href="https://github.com/AlBaraa-1/CleanEye-Hackathon" target="_blank" style="color: #667eea; text-decoration: none; font-weight: 600;">View on GitHub</a>
1054
  </p>
1055
+ <p style="margin: 10px 0; color: #6c757d; font-size: clamp(0.75rem, 2vw, 0.875rem);">
1056
  πŸ† Built for HuggingFace Gradio x BuildWithMCP Hackathon
1057
  </p>
1058
+ <p style="margin: 10px 0; color: #6c757d; font-size: clamp(0.75rem, 2vw, 0.875rem);">
1059
  Made with ❀️ using Python, Gradio, Claude MCP, FAISS, and Sentence Transformers
1060
  </p>
1061
  </div>