Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,6 +4,7 @@ import pandas as pd
|
|
| 4 |
import re
|
| 5 |
import nltk
|
| 6 |
import numpy as np
|
|
|
|
| 7 |
from khmernltk import word_tokenize
|
| 8 |
|
| 9 |
# --- 1. SETUP ---
|
|
@@ -157,7 +158,7 @@ def predict(text, model_name):
|
|
| 157 |
if vectors[0, idx] > 0:
|
| 158 |
keywords.append(feature_array[idx])
|
| 159 |
|
| 160 |
-
# ---
|
| 161 |
confidences = {}
|
| 162 |
top_label = ""
|
| 163 |
|
|
@@ -184,7 +185,7 @@ def predict(text, model_name):
|
|
| 184 |
return top_label, confidences, keywords
|
| 185 |
|
| 186 |
except Exception as e:
|
| 187 |
-
traceback.print_exc() #
|
| 188 |
return f"Error: {str(e)}", {}, []
|
| 189 |
|
| 190 |
# --- 4. LAUNCH ---
|
|
|
|
| 4 |
import re
|
| 5 |
import nltk
|
| 6 |
import numpy as np
|
| 7 |
+
import traceback
|
| 8 |
from khmernltk import word_tokenize
|
| 9 |
|
| 10 |
# --- 1. SETUP ---
|
|
|
|
| 158 |
if vectors[0, idx] > 0:
|
| 159 |
keywords.append(feature_array[idx])
|
| 160 |
|
| 161 |
+
# --- PREDICTION LOGIC ---
|
| 162 |
confidences = {}
|
| 163 |
top_label = ""
|
| 164 |
|
|
|
|
| 185 |
return top_label, confidences, keywords
|
| 186 |
|
| 187 |
except Exception as e:
|
| 188 |
+
traceback.print_exc() # Now this will work because we imported traceback
|
| 189 |
return f"Error: {str(e)}", {}, []
|
| 190 |
|
| 191 |
# --- 4. LAUNCH ---
|