ArnabDeo commited on
Commit
284d5a3
Β·
verified Β·
1 Parent(s): 09b29e2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +140 -9
app.py CHANGED
@@ -515,7 +515,7 @@ This may be due to Hugging Face Spaces resource limitations or model availabilit
515
  "N/A"
516
  )
517
 
518
- # Create Gradio interface with enhanced UI
519
  with gr.Blocks(
520
  theme=gr.themes.Soft(),
521
  title="⚑ Fast AI Stock Predictor",
@@ -535,11 +535,142 @@ with gr.Blocks(
535
  </div>
536
  """)
537
 
 
538
  gr.HTML("""
539
- <div class="disclaimer">
540
- <strong>⚠️ IMPORTANT DISCLAIMER:</strong> This tool is for educational purposes only.
541
- Not financial advice. AI predictions can be wrong. Always consult financial professionals
542
- before making investment decisions. Only invest what you can afford to lose.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
543
  </div>
544
  """)
545
 
@@ -671,13 +802,13 @@ with gr.Blocks(
671
  </div>
672
  """)
673
 
674
- # Launch configuration
675
  if __name__ == "__main__":
676
- # Enable queue using the new method
677
- #demo.queue(max_size=20) # Optional: set max queue size
678
 
679
  demo.launch(
680
- share=True,
681
  server_name="0.0.0.0",
682
  server_port=7860,
683
  show_error=True,
 
515
  "N/A"
516
  )
517
 
518
+ # Create Gradio interface with enhanced UI and improved disclaimer
519
  with gr.Blocks(
520
  theme=gr.themes.Soft(),
521
  title="⚑ Fast AI Stock Predictor",
 
535
  </div>
536
  """)
537
 
538
+ # Enhanced Disclaimer Section with Visual Design
539
  gr.HTML("""
540
+ <div style="max-width: 900px; margin: 20px auto; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;">
541
+ <!-- Main Disclaimer Box -->
542
+ <div style="background: linear-gradient(135deg, #ff6b6b20, #feca5720);
543
+ border: 2px solid #ff6b6b;
544
+ border-radius: 15px;
545
+ padding: 25px;
546
+ margin-bottom: 20px;
547
+ box-shadow: 0 4px 15px rgba(255, 107, 107, 0.2);">
548
+ <div style="text-align: center; margin-bottom: 20px;">
549
+ <h3 style="color: #2c3e50; margin: 0; font-size: 1.8em; font-weight: bold;">
550
+ ⚠️ IMPORTANT DISCLAIMER ⚠️
551
+ </h3>
552
+ </div>
553
+
554
+ <div style="background: white;
555
+ border-radius: 10px;
556
+ padding: 20px;
557
+ color: #2c3e50;
558
+ font-size: 16px;
559
+ line-height: 1.6;
560
+ box-shadow: inset 0 2px 5px rgba(0,0,0,0.1);">
561
+ <p style="margin: 0 0 15px 0; text-align: center; font-weight: bold; font-size: 18px;">
562
+ πŸ“š <strong>FOR EDUCATIONAL PURPOSES ONLY</strong> πŸ“š
563
+ </p>
564
+ <ul style="list-style: none; padding: 0; margin: 0;">
565
+ <li style="margin: 10px 0; padding: 8px; background: #f8f9fa; border-radius: 8px; border-left: 4px solid #3498db;">
566
+ <strong>🚫 NOT FINANCIAL ADVICE:</strong> This AI tool is for learning and research only
567
+ </li>
568
+ <li style="margin: 10px 0; padding: 8px; background: #f8f9fa; border-radius: 8px; border-left: 4px solid #e74c3c;">
569
+ <strong>⚑ AI CAN BE WRONG:</strong> Predictions may be inaccurate or completely wrong
570
+ </li>
571
+ <li style="margin: 10px 0; padding: 8px; background: #f8f9fa; border-radius: 8px; border-left: 4px solid #f39c12;">
572
+ <strong>πŸ’Ό CONSULT PROFESSIONALS:</strong> Always seek qualified financial advisors
573
+ </li>
574
+ <li style="margin: 10px 0; padding: 8px; background: #f8f9fa; border-radius: 8px; border-left: 4px solid #9b59b6;">
575
+ <strong>πŸ’° INVEST RESPONSIBLY:</strong> Only invest what you can afford to lose
576
+ </li>
577
+ </ul>
578
+ </div>
579
+ </div>
580
+
581
+ <!-- Trading Decision Guide for Beginners -->
582
+ <div style="display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 15px; margin: 20px 0;">
583
+
584
+ <!-- BUY Signal -->
585
+ <div style="background: linear-gradient(135deg, #27ae60, #2ecc71);
586
+ color: white;
587
+ padding: 20px;
588
+ border-radius: 15px;
589
+ text-align: center;
590
+ box-shadow: 0 4px 15px rgba(46, 204, 113, 0.3);
591
+ border: 3px solid #27ae60;">
592
+ <div style="font-size: 2.5em; margin-bottom: 10px;">πŸ“ˆ</div>
593
+ <h4 style="margin: 0 0 10px 0; font-size: 1.3em; font-weight: bold;">GREEN = BUY SIGNAL</h4>
594
+ <p style="margin: 0; font-size: 14px; opacity: 0.9;">
595
+ AI predicts price increase<br>
596
+ <strong>⚠️ Still risky - do research!</strong>
597
+ </p>
598
+ </div>
599
+
600
+ <!-- HOLD Signal -->
601
+ <div style="background: linear-gradient(135deg, #f39c12, #e67e22);
602
+ color: white;
603
+ padding: 20px;
604
+ border-radius: 15px;
605
+ text-align: center;
606
+ box-shadow: 0 4px 15px rgba(243, 156, 18, 0.3);
607
+ border: 3px solid #f39c12;">
608
+ <div style="font-size: 2.5em; margin-bottom: 10px;">βšͺ</div>
609
+ <h4 style="margin: 0 0 10px 0; font-size: 1.3em; font-weight: bold;">YELLOW = HOLD</h4>
610
+ <p style="margin: 0; font-size: 14px; opacity: 0.9;">
611
+ AI expects stable prices<br>
612
+ <strong>Wait and watch strategy</strong>
613
+ </p>
614
+ </div>
615
+
616
+ <!-- SELL Signal -->
617
+ <div style="background: linear-gradient(135deg, #e74c3c, #c0392b);
618
+ color: white;
619
+ padding: 20px;
620
+ border-radius: 15px;
621
+ text-align: center;
622
+ box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
623
+ border: 3px solid #e74c3c;">
624
+ <div style="font-size: 2.5em; margin-bottom: 10px;">πŸ“‰</div>
625
+ <h4 style="margin: 0 0 10px 0; font-size: 1.3em; font-weight: bold;">RED = SELL SIGNAL</h4>
626
+ <p style="margin: 0; font-size: 14px; opacity: 0.9;">
627
+ AI predicts price decrease<br>
628
+ <strong>Consider reducing exposure</strong>
629
+ </p>
630
+ </div>
631
+ </div>
632
+
633
+ <!-- Beginner Tips -->
634
+ <div style="background: linear-gradient(135deg, #3498db20, #9b59b620);
635
+ border: 2px solid #3498db;
636
+ border-radius: 15px;
637
+ padding: 20px;
638
+ margin-top: 20px;">
639
+ <h4 style="color: #2c3e50; margin: 0 0 15px 0; text-align: center; font-size: 1.4em;">
640
+ πŸ’‘ <strong>BEGINNER TIPS</strong> πŸ’‘
641
+ </h4>
642
+ <div style="display: grid; grid-template-columns: 1fr 1fr; gap: 15px; color: #2c3e50;">
643
+ <div style="background: white; padding: 15px; border-radius: 10px; box-shadow: 0 2px 10px rgba(0,0,0,0.1);">
644
+ <strong>🎯 Start Small:</strong><br>
645
+ Begin with small amounts you can afford to lose completely
646
+ </div>
647
+ <div style="background: white; padding: 15px; border-radius: 10px; box-shadow: 0 2px 10px rgba(0,0,0,0.1);">
648
+ <strong>πŸ“š Keep Learning:</strong><br>
649
+ Study finance basics before making real investments
650
+ </div>
651
+ <div style="background: white; padding: 15px; border-radius: 10px; box-shadow: 0 2px 10px rgba(0,0,0,0.1);">
652
+ <strong>🏦 Use Real Platforms:</strong><br>
653
+ Practice with paper trading before using real money
654
+ </div>
655
+ <div style="background: white; padding: 15px; border-radius: 10px; box-shadow: 0 2px 10px rgba(0,0,0,0.1);">
656
+ <strong>⏰ Think Long-term:</strong><br>
657
+ Don't panic on daily market fluctuations
658
+ </div>
659
+ </div>
660
+ </div>
661
+
662
+ <!-- Final Warning -->
663
+ <div style="background: #34495e;
664
+ color: white;
665
+ padding: 15px;
666
+ border-radius: 10px;
667
+ text-align: center;
668
+ margin-top: 20px;
669
+ border: 2px solid #2c3e50;">
670
+ <p style="margin: 0; font-weight: bold; font-size: 16px;">
671
+ 🚨 <strong>REMEMBER:</strong> Past performance β‰  Future results | Markets can crash | AI makes mistakes 🚨
672
+ </p>
673
+ </div>
674
  </div>
675
  """)
676
 
 
802
  </div>
803
  """)
804
 
805
+ # Launch configuration - Fixed for Gradio 4.0+
806
  if __name__ == "__main__":
807
+ # Enable queue using new Gradio 4.0+ method
808
+ demo.queue(max_size=20)
809
 
810
  demo.launch(
811
+ share=False, # Set to True for public sharing
812
  server_name="0.0.0.0",
813
  server_port=7860,
814
  show_error=True,