Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -393,21 +393,11 @@ def rag_predict_fn(text: str):
|
|
| 393 |
end_time = time.time()
|
| 394 |
elapsed_time = end_time - start_time
|
| 395 |
|
| 396 |
-
# Parse
|
| 397 |
-
|
|
|
|
| 398 |
explanation = response
|
| 399 |
|
| 400 |
-
# Clean up response for parsing
|
| 401 |
-
clean_response = response.strip()
|
| 402 |
-
|
| 403 |
-
# Basic parsing logic for "LABEL: ... EXPLANATION: ..." format
|
| 404 |
-
if "LABEL:" in clean_response:
|
| 405 |
-
try:
|
| 406 |
-
parts = clean_response.split("EXPLANATION:")
|
| 407 |
-
label_part = parts[0].replace("LABEL:", "").strip().upper()
|
| 408 |
-
if len(parts) > 1:
|
| 409 |
-
explanation = parts[1].strip()
|
| 410 |
-
else:
|
| 411 |
# Simple parsing logic
|
| 412 |
lines = response.split('\n')
|
| 413 |
for line in lines:
|
|
|
|
| 393 |
end_time = time.time()
|
| 394 |
elapsed_time = end_time - start_time
|
| 395 |
|
| 396 |
+
# Parse LLM Response (New Format)
|
| 397 |
+
classification = "UNKNOWN"
|
| 398 |
+
confidence = "N/A"
|
| 399 |
explanation = response
|
| 400 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 401 |
# Simple parsing logic
|
| 402 |
lines = response.split('\n')
|
| 403 |
for line in lines:
|