Update app.py
Browse files
app.py
CHANGED
@@ -190,14 +190,25 @@ def process_report(agent, file, messages: List[Dict[str, str]]) -> Tuple[List[Di
|
|
190 |
|
191 |
def create_ui(agent):
|
192 |
with gr.Blocks(css="""
|
|
|
193 |
html, body, .gradio-container {background: #0e1621; color: #e0e0e0;}
|
194 |
-
|
|
|
|
|
|
|
|
|
195 |
background: #1e88e5 !important;
|
196 |
-
|
|
|
197 |
color: white !important;
|
198 |
}
|
199 |
-
|
|
|
|
|
|
|
200 |
background: #1565c0 !important;
|
|
|
|
|
201 |
}
|
202 |
""") as demo:
|
203 |
gr.Markdown("""
|
@@ -207,9 +218,39 @@ def create_ui(agent):
|
|
207 |
with gr.Column():
|
208 |
chatbot = gr.Chatbot(label="CPS Assistant", height=700, type="messages")
|
209 |
upload = gr.File(label="Upload Medical File", file_types=[".xlsx"])
|
210 |
-
analyze = gr.Button("🧠 Analyze",
|
|
|
|
|
|
|
211 |
download = gr.File(label="Download Report", visible=False, interactive=False)
|
212 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
213 |
state = gr.State(value=[])
|
214 |
|
215 |
def handle_analysis(file, chat):
|
@@ -218,7 +259,6 @@ def create_ui(agent):
|
|
218 |
|
219 |
analyze.click(fn=handle_analysis, inputs=[upload, state], outputs=[chatbot, download, state])
|
220 |
return demo
|
221 |
-
|
222 |
# === Main ===
|
223 |
if __name__ == "__main__":
|
224 |
agent = init_agent()
|
|
|
190 |
|
191 |
def create_ui(agent):
|
192 |
with gr.Blocks(css="""
|
193 |
+
/* Main background styles */
|
194 |
html, body, .gradio-container {background: #0e1621; color: #e0e0e0;}
|
195 |
+
|
196 |
+
/* Force blue button with multiple selectors */
|
197 |
+
button#analyze-button,
|
198 |
+
button.gr-button-primary,
|
199 |
+
.gr-button-primary {
|
200 |
background: #1e88e5 !important;
|
201 |
+
background-color: #1e88e5 !important;
|
202 |
+
border-color: #1e88e5 !important;
|
203 |
color: white !important;
|
204 |
}
|
205 |
+
|
206 |
+
button#analyze-button:hover,
|
207 |
+
button.gr-button-primary:hover,
|
208 |
+
.gr-button-primary:hover {
|
209 |
background: #1565c0 !important;
|
210 |
+
background-color: #1565c0 !important;
|
211 |
+
border-color: #1565c0 !important;
|
212 |
}
|
213 |
""") as demo:
|
214 |
gr.Markdown("""
|
|
|
218 |
with gr.Column():
|
219 |
chatbot = gr.Chatbot(label="CPS Assistant", height=700, type="messages")
|
220 |
upload = gr.File(label="Upload Medical File", file_types=[".xlsx"])
|
221 |
+
analyze = gr.Button("🧠 Analyze",
|
222 |
+
variant="primary",
|
223 |
+
elem_id="analyze-button",
|
224 |
+
elem_classes=["force-blue-button"])
|
225 |
download = gr.File(label="Download Report", visible=False, interactive=False)
|
226 |
|
227 |
+
# Additional JavaScript to ensure button stays blue
|
228 |
+
demo.load(
|
229 |
+
None,
|
230 |
+
None,
|
231 |
+
None,
|
232 |
+
_js="""
|
233 |
+
() => {
|
234 |
+
// Double-check button color on load
|
235 |
+
const btn = document.getElementById('analyze-button');
|
236 |
+
if(btn) {
|
237 |
+
btn.style.backgroundColor = '#1e88e5';
|
238 |
+
btn.style.borderColor = '#1e88e5';
|
239 |
+
btn.style.color = 'white';
|
240 |
+
}
|
241 |
+
|
242 |
+
// Monitor for any color changes
|
243 |
+
setInterval(() => {
|
244 |
+
const btn = document.getElementById('analyze-button');
|
245 |
+
if(btn && window.getComputedStyle(btn).backgroundColor !== 'rgb(30, 136, 229)') {
|
246 |
+
btn.style.backgroundColor = '#1e88e5';
|
247 |
+
btn.style.borderColor = '#1e88e5';
|
248 |
+
}
|
249 |
+
}, 1000);
|
250 |
+
}
|
251 |
+
"""
|
252 |
+
)
|
253 |
+
|
254 |
state = gr.State(value=[])
|
255 |
|
256 |
def handle_analysis(file, chat):
|
|
|
259 |
|
260 |
analyze.click(fn=handle_analysis, inputs=[upload, state], outputs=[chatbot, download, state])
|
261 |
return demo
|
|
|
262 |
# === Main ===
|
263 |
if __name__ == "__main__":
|
264 |
agent = init_agent()
|