Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -17,34 +17,23 @@ from dotenv import load_dotenv
|
|
17 |
load_dotenv()
|
18 |
|
19 |
# Configure Gemini API
|
20 |
-
GEMINI_API_KEY = os.getenv("
|
21 |
genai.configure(api_key=GEMINI_API_KEY)
|
22 |
-
|
23 |
-
|
24 |
-
"top_p": 0.95,
|
25 |
-
"top_k": 64,
|
26 |
-
"max_output_tokens": 8192,
|
27 |
-
"response_mime_type": "text/plain",
|
28 |
-
}
|
29 |
-
|
30 |
-
model = genai.GenerativeModel(
|
31 |
-
model_name="gemini-2.0-pro-exp-02-05",
|
32 |
-
generation_config=generation_config,
|
33 |
-
)
|
34 |
|
35 |
-
|
36 |
-
|
37 |
-
# Custom CSS styling
|
38 |
CUSTOM_CSS = """
|
39 |
.gradio-container {
|
40 |
max-width: 1200px !important;
|
41 |
margin: auto !important;
|
42 |
padding: 20px !important;
|
43 |
-
background-color: #
|
|
|
44 |
}
|
45 |
|
46 |
.main-header {
|
47 |
-
background: linear-gradient(90deg, #2C3E50, #
|
48 |
color: white !important;
|
49 |
padding: 20px !important;
|
50 |
border-radius: 10px !important;
|
@@ -53,10 +42,11 @@ CUSTOM_CSS = """
|
|
53 |
}
|
54 |
|
55 |
.tab-content {
|
56 |
-
background:
|
57 |
padding: 20px !important;
|
58 |
border-radius: 10px !important;
|
59 |
-
box-shadow: 0 2px 4px rgba(0,0,0,0.
|
|
|
60 |
}
|
61 |
|
62 |
.action-button {
|
@@ -72,44 +62,107 @@ CUSTOM_CSS = """
|
|
72 |
.action-button:hover {
|
73 |
background: #2980B9 !important;
|
74 |
transform: translateY(-2px) !important;
|
|
|
75 |
}
|
76 |
|
77 |
.status-box {
|
78 |
-
background: #
|
79 |
border-left: 4px solid #3498DB !important;
|
80 |
padding: 15px !important;
|
81 |
margin: 10px 0 !important;
|
82 |
border-radius: 0 5px 5px 0 !important;
|
|
|
83 |
}
|
84 |
|
85 |
.chart-container {
|
86 |
-
background:
|
87 |
padding: 20px !important;
|
88 |
border-radius: 10px !important;
|
89 |
-
box-shadow: 0 2px 4px rgba(0,0,0,0.
|
|
|
90 |
}
|
91 |
|
92 |
.chat-container {
|
93 |
height: 400px !important;
|
94 |
overflow-y: auto !important;
|
95 |
-
border: 1px solid #
|
96 |
border-radius: 10px !important;
|
97 |
padding: 15px !important;
|
|
|
|
|
98 |
}
|
99 |
|
100 |
.file-upload {
|
101 |
-
border: 2px dashed #
|
102 |
border-radius: 10px !important;
|
103 |
padding: 20px !important;
|
104 |
text-align: center !important;
|
|
|
|
|
105 |
}
|
106 |
|
107 |
.result-box {
|
108 |
-
background: #
|
109 |
-
border: 1px solid #
|
110 |
border-radius: 10px !important;
|
111 |
padding: 20px !important;
|
112 |
margin-top: 15px !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
}
|
114 |
"""
|
115 |
|
|
|
17 |
load_dotenv()
|
18 |
|
19 |
# Configure Gemini API
|
20 |
+
GEMINI_API_KEY = os.getenv("GEMINI_API_KEY")
|
21 |
genai.configure(api_key=GEMINI_API_KEY)
|
22 |
+
model = genai.GenerativeModel('gemini-pro')
|
23 |
+
chat_model = genai.GenerativeModel('gemini-pro')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
+
# Custom CSS styling for dark mode
|
|
|
|
|
26 |
CUSTOM_CSS = """
|
27 |
.gradio-container {
|
28 |
max-width: 1200px !important;
|
29 |
margin: auto !important;
|
30 |
padding: 20px !important;
|
31 |
+
background-color: #1a1a1a !important;
|
32 |
+
color: #ffffff !important;
|
33 |
}
|
34 |
|
35 |
.main-header {
|
36 |
+
background: linear-gradient(90deg, #2C3E50, #1e3c72);
|
37 |
color: white !important;
|
38 |
padding: 20px !important;
|
39 |
border-radius: 10px !important;
|
|
|
42 |
}
|
43 |
|
44 |
.tab-content {
|
45 |
+
background: #2d2d2d !important;
|
46 |
padding: 20px !important;
|
47 |
border-radius: 10px !important;
|
48 |
+
box-shadow: 0 2px 4px rgba(0,0,0,0.2) !important;
|
49 |
+
color: #ffffff !important;
|
50 |
}
|
51 |
|
52 |
.action-button {
|
|
|
62 |
.action-button:hover {
|
63 |
background: #2980B9 !important;
|
64 |
transform: translateY(-2px) !important;
|
65 |
+
box-shadow: 0 4px 8px rgba(0,0,0,0.2) !important;
|
66 |
}
|
67 |
|
68 |
.status-box {
|
69 |
+
background: #363636 !important;
|
70 |
border-left: 4px solid #3498DB !important;
|
71 |
padding: 15px !important;
|
72 |
margin: 10px 0 !important;
|
73 |
border-radius: 0 5px 5px 0 !important;
|
74 |
+
color: #ffffff !important;
|
75 |
}
|
76 |
|
77 |
.chart-container {
|
78 |
+
background: #2d2d2d !important;
|
79 |
padding: 20px !important;
|
80 |
border-radius: 10px !important;
|
81 |
+
box-shadow: 0 2px 4px rgba(0,0,0,0.2) !important;
|
82 |
+
color: #ffffff !important;
|
83 |
}
|
84 |
|
85 |
.chat-container {
|
86 |
height: 400px !important;
|
87 |
overflow-y: auto !important;
|
88 |
+
border: 1px solid #404040 !important;
|
89 |
border-radius: 10px !important;
|
90 |
padding: 15px !important;
|
91 |
+
background: #2d2d2d !important;
|
92 |
+
color: #ffffff !important;
|
93 |
}
|
94 |
|
95 |
.file-upload {
|
96 |
+
border: 2px dashed #404040 !important;
|
97 |
border-radius: 10px !important;
|
98 |
padding: 20px !important;
|
99 |
text-align: center !important;
|
100 |
+
background: #2d2d2d !important;
|
101 |
+
color: #ffffff !important;
|
102 |
}
|
103 |
|
104 |
.result-box {
|
105 |
+
background: #363636 !important;
|
106 |
+
border: 1px solid #404040 !important;
|
107 |
border-radius: 10px !important;
|
108 |
padding: 20px !important;
|
109 |
margin-top: 15px !important;
|
110 |
+
color: #ffffff !important;
|
111 |
+
}
|
112 |
+
|
113 |
+
/* Additional dark mode styles */
|
114 |
+
.tabs {
|
115 |
+
background: #2d2d2d !important;
|
116 |
+
border-radius: 10px !important;
|
117 |
+
padding: 10px !important;
|
118 |
+
}
|
119 |
+
|
120 |
+
.tab-selected {
|
121 |
+
background: #3498DB !important;
|
122 |
+
color: white !important;
|
123 |
+
}
|
124 |
+
|
125 |
+
input, select, textarea {
|
126 |
+
background: #363636 !important;
|
127 |
+
color: #ffffff !important;
|
128 |
+
border: 1px solid #404040 !important;
|
129 |
+
}
|
130 |
+
|
131 |
+
input:focus, select:focus, textarea:focus {
|
132 |
+
border-color: #3498DB !important;
|
133 |
+
box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2) !important;
|
134 |
+
}
|
135 |
+
|
136 |
+
.label-text {
|
137 |
+
color: #ffffff !important;
|
138 |
+
}
|
139 |
+
|
140 |
+
.gr-box {
|
141 |
+
background: #2d2d2d !important;
|
142 |
+
border: 1px solid #404040 !important;
|
143 |
+
}
|
144 |
+
|
145 |
+
.gr-text-input {
|
146 |
+
background: #363636 !important;
|
147 |
+
color: #ffffff !important;
|
148 |
+
}
|
149 |
+
|
150 |
+
.gr-checkbox {
|
151 |
+
border-color: #404040 !important;
|
152 |
+
}
|
153 |
+
|
154 |
+
.gr-checkbox:checked {
|
155 |
+
background-color: #3498DB !important;
|
156 |
+
}
|
157 |
+
|
158 |
+
.gr-button-primary {
|
159 |
+
background: #3498DB !important;
|
160 |
+
color: white !important;
|
161 |
+
}
|
162 |
+
|
163 |
+
.gr-button-secondary {
|
164 |
+
background: #404040 !important;
|
165 |
+
color: white !important;
|
166 |
}
|
167 |
"""
|
168 |
|