Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,128 @@
|
|
| 1 |
import os
|
|
|
|
|
|
|
| 2 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
import pandas as pd
|
| 4 |
import google.generativeai as genai
|
| 5 |
import joblib
|
|
@@ -763,6 +886,13 @@ def create_interface():
|
|
| 763 |
inputs=[report_options],
|
| 764 |
outputs=[report_download]
|
| 765 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 766 |
|
| 767 |
return demo
|
| 768 |
|
|
|
|
| 1 |
import os
|
| 2 |
+
import sys
|
| 3 |
+
from dotenv import load_dotenv
|
| 4 |
import gradio as gr
|
| 5 |
+
from typing import Optional, Dict, List, Union
|
| 6 |
+
import logging
|
| 7 |
+
|
| 8 |
+
# Custom CSS
|
| 9 |
+
CUSTOM_CSS = """
|
| 10 |
+
.footer {
|
| 11 |
+
text-align: center !important;
|
| 12 |
+
padding: 20px !important;
|
| 13 |
+
margin-top: 40px !important;
|
| 14 |
+
border-top: 1px solid #404040 !important;
|
| 15 |
+
color: #89CFF0 !important;
|
| 16 |
+
font-size: 1.1em !important;
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
.gradio-container {
|
| 20 |
+
max-width: 1200px !important;
|
| 21 |
+
margin: auto !important;
|
| 22 |
+
padding: 20px !important;
|
| 23 |
+
background-color: #1a1a1a !important;
|
| 24 |
+
color: #ffffff !important;
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
.main-header {
|
| 28 |
+
background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%) !important;
|
| 29 |
+
color: white !important;
|
| 30 |
+
padding: 30px !important;
|
| 31 |
+
border-radius: 15px !important;
|
| 32 |
+
margin-bottom: 30px !important;
|
| 33 |
+
text-align: center !important;
|
| 34 |
+
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2) !important;
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
.app-title {
|
| 38 |
+
font-size: 2.5em !important;
|
| 39 |
+
font-weight: bold !important;
|
| 40 |
+
margin-bottom: 10px !important;
|
| 41 |
+
background: linear-gradient(90deg, #ffffff, #3498DB) !important;
|
| 42 |
+
-webkit-background-clip: text !important;
|
| 43 |
+
-webkit-text-fill-color: transparent !important;
|
| 44 |
+
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3) !important;
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
.app-subtitle {
|
| 48 |
+
font-size: 1.3em !important;
|
| 49 |
+
color: #89CFF0 !important;
|
| 50 |
+
margin-bottom: 15px !important;
|
| 51 |
+
font-weight: 500 !important;
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
.app-description {
|
| 55 |
+
font-size: 1.1em !important;
|
| 56 |
+
color: #B0C4DE !important;
|
| 57 |
+
margin-bottom: 20px !important;
|
| 58 |
+
line-height: 1.5 !important;
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
.gr-checkbox-group {
|
| 62 |
+
background: #363636 !important;
|
| 63 |
+
padding: 15px !important;
|
| 64 |
+
border-radius: 10px !important;
|
| 65 |
+
margin: 10px 0 !important;
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
.gr-slider {
|
| 69 |
+
margin-top: 10px !important;
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
.status-message {
|
| 73 |
+
margin-top: 10px !important;
|
| 74 |
+
padding: 8px !important;
|
| 75 |
+
border-radius: 4px !important;
|
| 76 |
+
background-color: #2d2d2d !important;
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
.result-box {
|
| 80 |
+
background: #363636 !important;
|
| 81 |
+
border: 1px solid #404040 !important;
|
| 82 |
+
border-radius: 10px !important;
|
| 83 |
+
padding: 20px !important;
|
| 84 |
+
margin-top: 15px !important;
|
| 85 |
+
color: #ffffff !important;
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
.chart-container {
|
| 89 |
+
background: #2d2d2d !important;
|
| 90 |
+
padding: 20px !important;
|
| 91 |
+
border-radius: 10px !important;
|
| 92 |
+
box-shadow: 0 2px 4px rgba(0,0,0,0.2) !important;
|
| 93 |
+
color: #ffffff !important;
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
.action-button {
|
| 97 |
+
background: #3498DB !important;
|
| 98 |
+
color: white !important;
|
| 99 |
+
border: none !important;
|
| 100 |
+
padding: 10px 20px !important;
|
| 101 |
+
border-radius: 5px !important;
|
| 102 |
+
cursor: pointer !important;
|
| 103 |
+
transition: all 0.3s ease !important;
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
.action-button:hover {
|
| 107 |
+
background: #2980B9 !important;
|
| 108 |
+
transform: translateY(-2px) !important;
|
| 109 |
+
box-shadow: 0 4px 8px rgba(0,0,0,0.2) !important;
|
| 110 |
+
}
|
| 111 |
+
"""
|
| 112 |
+
|
| 113 |
+
# Configure logging
|
| 114 |
+
logging.basicConfig(
|
| 115 |
+
level=logging.INFO,
|
| 116 |
+
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
|
| 117 |
+
)
|
| 118 |
+
logger = logging.getLogger(__name__)
|
| 119 |
+
|
| 120 |
+
# Load environment variables
|
| 121 |
+
load_dotenv()
|
| 122 |
+
|
| 123 |
+
# Constants
|
| 124 |
+
MAX_FILE_SIZE = 50 * 1024 * 1024 # 50MB
|
| 125 |
+
ALLOWED_EXTENSIONS = {'.xlsx', '.xls', '.csv'}
|
| 126 |
import pandas as pd
|
| 127 |
import google.generativeai as genai
|
| 128 |
import joblib
|
|
|
|
| 886 |
inputs=[report_options],
|
| 887 |
outputs=[report_download]
|
| 888 |
)
|
| 889 |
+
|
| 890 |
+
# Footer
|
| 891 |
+
gr.HTML(
|
| 892 |
+
'''<div class="footer">
|
| 893 |
+
Made with ❤️ by Aditya Ratan
|
| 894 |
+
</div>'''
|
| 895 |
+
)
|
| 896 |
|
| 897 |
return demo
|
| 898 |
|