Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -135,18 +135,18 @@ def lookup_profile():
|
|
135 |
df = load_profiles()
|
136 |
assessment_id = assessment_id_input.value.strip()
|
137 |
if not assessment_id:
|
138 |
-
|
139 |
return
|
140 |
|
141 |
results = df[df["Assessment_ID"].str.contains(assessment_id, case=False)]
|
142 |
if results.empty:
|
143 |
-
|
144 |
return
|
145 |
|
146 |
profile_preview.update(
|
147 |
value=results.to_markdown(index=False)
|
148 |
)
|
149 |
-
|
150 |
|
151 |
"""Gradio User Interface"""
|
152 |
#audio_input = gr.Audio(sources="upload", type="filepath", label="Audio: from file") #gr.Audio(sources="microphone", type="filepath", label="Audio: from microphone")
|
@@ -163,13 +163,13 @@ with gr.Blocks() as profile_interface:
|
|
163 |
)
|
164 |
lookup_btn = gr.Button("Lookup Profile", variant="primary")
|
165 |
clear_btn = gr.Button("Clear Results", variant="secondary")
|
166 |
-
|
167 |
profile_preview = gr.Markdown(label="Profile Results", value="")
|
168 |
|
169 |
# Event Bindings
|
170 |
lookup_btn.click(lookup_profile, None, None)
|
171 |
-
clear_btn.click(lambda: profile_preview.update(""),
|
172 |
-
assessment_id_input.change(lambda:
|
173 |
|
174 |
# Profile Interface
|
175 |
|
|
|
135 |
df = load_profiles()
|
136 |
assessment_id = assessment_id_input.value.strip()
|
137 |
if not assessment_id:
|
138 |
+
state.update("Please enter an Assessment ID", color="red")
|
139 |
return
|
140 |
|
141 |
results = df[df["Assessment_ID"].str.contains(assessment_id, case=False)]
|
142 |
if results.empty:
|
143 |
+
state.update("No profiles found for this ID", color="red")
|
144 |
return
|
145 |
|
146 |
profile_preview.update(
|
147 |
value=results.to_markdown(index=False)
|
148 |
)
|
149 |
+
state.update("Profile(s) found!", color="green")
|
150 |
|
151 |
"""Gradio User Interface"""
|
152 |
#audio_input = gr.Audio(sources="upload", type="filepath", label="Audio: from file") #gr.Audio(sources="microphone", type="filepath", label="Audio: from microphone")
|
|
|
163 |
)
|
164 |
lookup_btn = gr.Button("Lookup Profile", variant="primary")
|
165 |
clear_btn = gr.Button("Clear Results", variant="secondary")
|
166 |
+
state = gr.State(elem_classes="status-container")
|
167 |
profile_preview = gr.Markdown(label="Profile Results", value="")
|
168 |
|
169 |
# Event Bindings
|
170 |
lookup_btn.click(lookup_profile, None, None)
|
171 |
+
clear_btn.click(lambda: profile_preview.update(""), state.update("", color=""))
|
172 |
+
assessment_id_input.change(lambda: state.update("", color=""), None, None)
|
173 |
|
174 |
# Profile Interface
|
175 |
|