Spaces:
Sleeping
Sleeping
Commit Β·
ade2111
1
Parent(s): fdbfbee
Add application file
Browse files- __pycache__/app.cpython-311.pyc +0 -0
- app.py +4 -7
__pycache__/app.cpython-311.pyc
CHANGED
|
Binary files a/__pycache__/app.cpython-311.pyc and b/__pycache__/app.cpython-311.pyc differ
|
|
|
app.py
CHANGED
|
@@ -290,8 +290,6 @@ def fmea_rag_interface(mode, effect, cause, severity, occurrence, detection):
|
|
| 290 |
output_df['new_O'] = output_df['new_O'].astype(int)
|
| 291 |
output_df['new_D'] = output_df['new_D'].astype(int)
|
| 292 |
output_df['new_RPN'] = output_df['new_S'] * output_df['new_O'] * output_df['new_D']
|
| 293 |
-
output_df['generated_at'] = datetime.now(timezone.utc).strftime("%Y-%m-%d %H:%M:%S UTC")
|
| 294 |
-
|
| 295 |
rpn_change_list = [f"{int(rpn)} β {int(new_rpn)}" for new_rpn in output_df['new_RPN']]
|
| 296 |
|
| 297 |
display_df = pd.DataFrame({
|
|
@@ -301,8 +299,7 @@ def fmea_rag_interface(mode, effect, cause, severity, occurrence, detection):
|
|
| 301 |
"Department": output_df['department'],
|
| 302 |
"AI Confidence": [f"{score}%" for score in output_df['ai_score']],
|
| 303 |
"Avg. Feedback": [f"{avg:.2f}/10 ({int(count)})" for avg, count in zip(output_df['avg_feedback'], output_df['feedback_count'])],
|
| 304 |
-
"Revised RPN": rpn_change_list
|
| 305 |
-
"Generated At (UTC)": output_df['generated_at']
|
| 306 |
})
|
| 307 |
|
| 308 |
except Exception as e:
|
|
@@ -347,14 +344,14 @@ if build_rag_chain():
|
|
| 347 |
gr.Markdown("## π‘ Top 3 AI-Generated Recommendations")
|
| 348 |
rpn_output = gr.Textbox(label="Current RPN", interactive=False)
|
| 349 |
recommendations_output = gr.DataFrame(
|
| 350 |
-
headers=["Rank", "Recommended Action", "Action Details", "Department", "AI Confidence", "Avg. Feedback", "Revised RPN"
|
| 351 |
-
datatype=["number", "str", "str", "str", "str", "str", "str"
|
| 352 |
)
|
| 353 |
df_state = gr.State()
|
| 354 |
|
| 355 |
with gr.Group():
|
| 356 |
gr.Markdown("## β Provide Feedback")
|
| 357 |
-
gr.Markdown("Click a row in the table above to select it, then submit
|
| 358 |
selected_action_text = gr.Textbox(label="Selected for Feedback", interactive=False)
|
| 359 |
feedback_choice = gr.Radio(
|
| 360 |
choices=["π Thumbs Up", "π Thumbs Down"],
|
|
|
|
| 290 |
output_df['new_O'] = output_df['new_O'].astype(int)
|
| 291 |
output_df['new_D'] = output_df['new_D'].astype(int)
|
| 292 |
output_df['new_RPN'] = output_df['new_S'] * output_df['new_O'] * output_df['new_D']
|
|
|
|
|
|
|
| 293 |
rpn_change_list = [f"{int(rpn)} β {int(new_rpn)}" for new_rpn in output_df['new_RPN']]
|
| 294 |
|
| 295 |
display_df = pd.DataFrame({
|
|
|
|
| 299 |
"Department": output_df['department'],
|
| 300 |
"AI Confidence": [f"{score}%" for score in output_df['ai_score']],
|
| 301 |
"Avg. Feedback": [f"{avg:.2f}/10 ({int(count)})" for avg, count in zip(output_df['avg_feedback'], output_df['feedback_count'])],
|
| 302 |
+
"Revised RPN": rpn_change_list
|
|
|
|
| 303 |
})
|
| 304 |
|
| 305 |
except Exception as e:
|
|
|
|
| 344 |
gr.Markdown("## π‘ Top 3 AI-Generated Recommendations")
|
| 345 |
rpn_output = gr.Textbox(label="Current RPN", interactive=False)
|
| 346 |
recommendations_output = gr.DataFrame(
|
| 347 |
+
headers=["Rank", "Recommended Action", "Action Details", "Department", "AI Confidence", "Avg. Feedback", "Revised RPN"],
|
| 348 |
+
datatype=["number", "str", "str", "str", "str", "str", "str"]
|
| 349 |
)
|
| 350 |
df_state = gr.State()
|
| 351 |
|
| 352 |
with gr.Group():
|
| 353 |
gr.Markdown("## β Provide Feedback")
|
| 354 |
+
gr.Markdown("Click a row in the table above to select it, then submit a thumbs up or thumbs down.")
|
| 355 |
selected_action_text = gr.Textbox(label="Selected for Feedback", interactive=False)
|
| 356 |
feedback_choice = gr.Radio(
|
| 357 |
choices=["π Thumbs Up", "π Thumbs Down"],
|