Update app.py
Browse files
app.py
CHANGED
|
@@ -190,29 +190,19 @@ 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 |
-
/* 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 |
-
|
| 208 |
-
|
| 209 |
-
background: #1e88e5 !important;
|
| 210 |
-
border: none !important;
|
| 211 |
color: white !important;
|
|
|
|
| 212 |
}
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
|
|
|
| 216 |
}
|
| 217 |
""") as demo:
|
| 218 |
gr.Markdown("""
|
|
@@ -222,39 +212,9 @@ def create_ui(agent):
|
|
| 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,6 +223,7 @@ def create_ui(agent):
|
|
| 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()
|
|
|
|
| 190 |
|
| 191 |
def create_ui(agent):
|
| 192 |
with gr.Blocks(css="""
|
| 193 |
+
html, body, .gradio-container {
|
| 194 |
+
background: #0e1621; color: #e0e0e0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 195 |
}
|
| 196 |
+
button.svelte-1ipelgc {
|
| 197 |
+
background: linear-gradient(to right, #1e88e5, #0d47a1) !important;
|
| 198 |
+
border: 1px solid #0d47a1 !important;
|
|
|
|
|
|
|
| 199 |
color: white !important;
|
| 200 |
+
font-weight: bold !important;
|
| 201 |
}
|
| 202 |
+
button.svelte-1ipelgc:hover {
|
| 203 |
+
background: linear-gradient(to right, #2196f3, #1565c0) !important;
|
| 204 |
+
border: 1px solid #1565c0 !important;
|
| 205 |
+
color: white !important;
|
| 206 |
}
|
| 207 |
""") as demo:
|
| 208 |
gr.Markdown("""
|
|
|
|
| 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 |
|
| 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()
|