Update app.py
Browse files
app.py
CHANGED
|
@@ -190,20 +190,30 @@ 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 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
button
|
| 197 |
-
|
| 198 |
-
|
|
|
|
| 199 |
color: white !important;
|
| 200 |
-
font-weight: bold !important;
|
| 201 |
}
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 205 |
color: white !important;
|
| 206 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 207 |
""") as demo:
|
| 208 |
gr.Markdown("""
|
| 209 |
<h2>π CPS: Clinical Patient Support System</h2>
|
|
@@ -212,9 +222,39 @@ def create_ui(agent):
|
|
| 212 |
with gr.Column():
|
| 213 |
chatbot = gr.Chatbot(label="CPS Assistant", height=700, type="messages")
|
| 214 |
upload = gr.File(label="Upload Medical File", file_types=[".xlsx"])
|
| 215 |
-
analyze = gr.Button("π§ Analyze"
|
|
|
|
|
|
|
| 216 |
download = gr.File(label="Download Report", visible=False, interactive=False)
|
| 217 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 218 |
state = gr.State(value=[])
|
| 219 |
|
| 220 |
def handle_analysis(file, chat):
|
|
@@ -223,7 +263,6 @@ def create_ui(agent):
|
|
| 223 |
|
| 224 |
analyze.click(fn=handle_analysis, inputs=[upload, state], outputs=[chatbot, download, state])
|
| 225 |
return demo
|
| 226 |
-
|
| 227 |
# === Main ===
|
| 228 |
if __name__ == "__main__":
|
| 229 |
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 |
+
/* Direct button styling */
|
| 197 |
+
button {
|
| 198 |
+
background: #1e88e5 !important;
|
| 199 |
+
border: none !important;
|
| 200 |
color: white !important;
|
|
|
|
| 201 |
}
|
| 202 |
+
|
| 203 |
+
button:hover {
|
| 204 |
+
background: #1565c0 !important;
|
| 205 |
+
}
|
| 206 |
+
|
| 207 |
+
/* Specific button override */
|
| 208 |
+
#analyze-button {
|
| 209 |
+
background: #1e88e5 !important;
|
| 210 |
+
border: none !important;
|
| 211 |
color: white !important;
|
| 212 |
}
|
| 213 |
+
|
| 214 |
+
#analyze-button:hover {
|
| 215 |
+
background: #1565c0 !important;
|
| 216 |
+
}
|
| 217 |
""") as demo:
|
| 218 |
gr.Markdown("""
|
| 219 |
<h2>π CPS: Clinical Patient Support System</h2>
|
|
|
|
| 222 |
with gr.Column():
|
| 223 |
chatbot = gr.Chatbot(label="CPS Assistant", height=700, type="messages")
|
| 224 |
upload = gr.File(label="Upload Medical File", file_types=[".xlsx"])
|
| 225 |
+
analyze = gr.Button("π§ Analyze",
|
| 226 |
+
variant="primary",
|
| 227 |
+
elem_id="analyze-button")
|
| 228 |
download = gr.File(label="Download Report", visible=False, interactive=False)
|
| 229 |
|
| 230 |
+
# Add JavaScript to force the button color
|
| 231 |
+
demo.load(
|
| 232 |
+
None,
|
| 233 |
+
None,
|
| 234 |
+
None,
|
| 235 |
+
_js="""
|
| 236 |
+
function forceBlueButton() {
|
| 237 |
+
const btn = document.getElementById('analyze-button');
|
| 238 |
+
if (btn) {
|
| 239 |
+
btn.style.backgroundColor = '#1e88e5';
|
| 240 |
+
btn.style.border = 'none';
|
| 241 |
+
btn.style.color = 'white';
|
| 242 |
+
|
| 243 |
+
btn.addEventListener('mouseover', function() {
|
| 244 |
+
this.style.backgroundColor = '#1565c0';
|
| 245 |
+
});
|
| 246 |
+
|
| 247 |
+
btn.addEventListener('mouseout', function() {
|
| 248 |
+
this.style.backgroundColor = '#1e88e5';
|
| 249 |
+
});
|
| 250 |
+
} else {
|
| 251 |
+
setTimeout(forceBlueButton, 100);
|
| 252 |
+
}
|
| 253 |
+
}
|
| 254 |
+
forceBlueButton();
|
| 255 |
+
"""
|
| 256 |
+
)
|
| 257 |
+
|
| 258 |
state = gr.State(value=[])
|
| 259 |
|
| 260 |
def handle_analysis(file, chat):
|
|
|
|
| 263 |
|
| 264 |
analyze.click(fn=handle_analysis, inputs=[upload, state], outputs=[chatbot, download, state])
|
| 265 |
return demo
|
|
|
|
| 266 |
# === Main ===
|
| 267 |
if __name__ == "__main__":
|
| 268 |
agent = init_agent()
|