Update app.py
Browse files
app.py
CHANGED
|
@@ -190,25 +190,13 @@ 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 |
-
/* 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 |
-
|
| 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,39 +206,9 @@ def create_ui(agent):
|
|
| 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,6 +217,7 @@ def create_ui(agent):
|
|
| 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()
|
|
|
|
| 190 |
|
| 191 |
def create_ui(agent):
|
| 192 |
with gr.Blocks(css="""
|
|
|
|
| 193 |
html, body, .gradio-container {background: #0e1621; color: #e0e0e0;}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 194 |
.gr-button-primary {
|
| 195 |
+
background: linear-gradient(to bottom, #1e88e5, #0d47a1) !important;
|
| 196 |
+
border: none !important;
|
|
|
|
|
|
|
| 197 |
}
|
|
|
|
|
|
|
|
|
|
| 198 |
.gr-button-primary:hover {
|
| 199 |
+
background: linear-gradient(to bottom, #2196f3, #1565c0) !important;
|
|
|
|
|
|
|
| 200 |
}
|
| 201 |
""") as demo:
|
| 202 |
gr.Markdown("""
|
|
|
|
| 206 |
with gr.Column():
|
| 207 |
chatbot = gr.Chatbot(label="CPS Assistant", height=700, type="messages")
|
| 208 |
upload = gr.File(label="Upload Medical File", file_types=[".xlsx"])
|
| 209 |
+
analyze = gr.Button("🧠 Analyze", variant="primary")
|
|
|
|
|
|
|
|
|
|
| 210 |
download = gr.File(label="Download Report", visible=False, interactive=False)
|
| 211 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 212 |
state = gr.State(value=[])
|
| 213 |
|
| 214 |
def handle_analysis(file, chat):
|
|
|
|
| 217 |
|
| 218 |
analyze.click(fn=handle_analysis, inputs=[upload, state], outputs=[chatbot, download, state])
|
| 219 |
return demo
|
| 220 |
+
|
| 221 |
# === Main ===
|
| 222 |
if __name__ == "__main__":
|
| 223 |
agent = init_agent()
|