Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -50,13 +50,20 @@ async def update_validation_space_on_answer(response, type, timestamp):
|
|
50 |
# You would need to import the create_validation_space function
|
51 |
from build_space import create_validation_space
|
52 |
validation_dataset = create_validation_space(country)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
|
54 |
# Create a validation record with the correct attribute
|
55 |
# Instead of response.value, we need to find the correct attribute
|
56 |
# Based on the error, let's try to get the value differently
|
57 |
validation_record = {
|
58 |
"question": record.fields["question"],
|
59 |
-
"answer":
|
60 |
}
|
61 |
|
62 |
# Add the record to the validation space
|
|
|
50 |
# You would need to import the create_validation_space function
|
51 |
from build_space import create_validation_space
|
52 |
validation_dataset = create_validation_space(country)
|
53 |
+
|
54 |
+
response_value = None
|
55 |
+
if hasattr(response, 'values') and 'text' in response.values:
|
56 |
+
if isinstance(response.values['text'], dict) and 'value' in response.values['text']:
|
57 |
+
response_value = response.values['text']['value']
|
58 |
+
else:
|
59 |
+
response_value = str(response.values['text'])
|
60 |
|
61 |
# Create a validation record with the correct attribute
|
62 |
# Instead of response.value, we need to find the correct attribute
|
63 |
# Based on the error, let's try to get the value differently
|
64 |
validation_record = {
|
65 |
"question": record.fields["question"],
|
66 |
+
"answer": response_value,
|
67 |
}
|
68 |
|
69 |
# Add the record to the validation space
|