Update app.py
Browse files
app.py
CHANGED
|
@@ -85,9 +85,11 @@ def process_text(text):
|
|
| 85 |
start_time = normalize_data_time(start_str)
|
| 86 |
end_time = normalize_data_time(end_str)
|
| 87 |
else:
|
| 88 |
-
|
| 89 |
-
if entities["TIME"]:
|
| 90 |
start_time = normalize_data_time(entities["TIME"][0])
|
|
|
|
|
|
|
| 91 |
|
| 92 |
# Calculate duration if both start and end times are available
|
| 93 |
if start_time and end_time:
|
|
|
|
| 85 |
start_time = normalize_data_time(start_str)
|
| 86 |
end_time = normalize_data_time(end_str)
|
| 87 |
else:
|
| 88 |
+
# If no range, use the first and second TIME entities
|
| 89 |
+
if len(entities["TIME"]) >= 1:
|
| 90 |
start_time = normalize_data_time(entities["TIME"][0])
|
| 91 |
+
if len(entities["TIME"]) >= 2:
|
| 92 |
+
end_time = normalize_data_time(entities["TIME"][1])
|
| 93 |
|
| 94 |
# Calculate duration if both start and end times are available
|
| 95 |
if start_time and end_time:
|