Spaces:
Sleeping
Sleeping
Saiteja Solleti
commited on
Commit
·
754ca59
1
Parent(s):
4601ab4
popup window
Browse files
app.py
CHANGED
@@ -96,10 +96,14 @@ def EvaluateRAGModel(question, evaluation_model, reranking_model):
|
|
96 |
|
97 |
execution_time = end_time - start_time
|
98 |
|
99 |
-
return answer, rmsecontextrel, rmsecontextutil, aucscore, execution_time
|
100 |
except Exception as e:
|
101 |
-
|
102 |
-
|
|
|
|
|
|
|
|
|
103 |
|
104 |
# Create Gradio UI
|
105 |
with gr.Blocks() as iface:
|
@@ -124,9 +128,8 @@ with gr.Blocks() as iface:
|
|
124 |
|
125 |
submit_button = gr.Button("Evaluate Model")
|
126 |
|
127 |
-
|
128 |
-
|
129 |
-
error_text = gr.Textbox(interactive=False, show_label=False)
|
130 |
|
131 |
with gr.Row():
|
132 |
with gr.Column():
|
@@ -155,8 +158,8 @@ with gr.Blocks() as iface:
|
|
155 |
submit_button.click(
|
156 |
EvaluateRAGModel,
|
157 |
inputs=[question_input, dropdown_input,reranker_dropdown],
|
158 |
-
outputs=[response, rmsecontextrel, rmsecontextutil, aucscore, processingTime,
|
159 |
-
)
|
160 |
|
161 |
# Run the Gradio app
|
162 |
iface.launch()
|
|
|
96 |
|
97 |
execution_time = end_time - start_time
|
98 |
|
99 |
+
return answer, rmsecontextrel, rmsecontextutil, aucscore, execution_time, gr.update(visible=False)
|
100 |
except Exception as e:
|
101 |
+
error_message = f"""
|
102 |
+
<div style="background-color: #ffcccc; color: red; padding: 10px; border-radius: 5px; font-weight: bold;">
|
103 |
+
⚠️ <b>Error:</b> {str(e)}
|
104 |
+
</div>
|
105 |
+
"""
|
106 |
+
return "I apologize, but I encountered an error processing your question. Please try again.", 0, 0, 0, time.time() - start_time, gr.update(value=error_message, visible=True)
|
107 |
|
108 |
# Create Gradio UI
|
109 |
with gr.Blocks() as iface:
|
|
|
128 |
|
129 |
submit_button = gr.Button("Evaluate Model")
|
130 |
|
131 |
+
# Simulated "Popup" Error Message (Initially Hidden)
|
132 |
+
error_message_box = gr.HTML("", visible=False)
|
|
|
133 |
|
134 |
with gr.Row():
|
135 |
with gr.Column():
|
|
|
158 |
submit_button.click(
|
159 |
EvaluateRAGModel,
|
160 |
inputs=[question_input, dropdown_input,reranker_dropdown],
|
161 |
+
outputs=[response, rmsecontextrel, rmsecontextutil, aucscore, processingTime, error_message_box]
|
162 |
+
)
|
163 |
|
164 |
# Run the Gradio app
|
165 |
iface.launch()
|