Gleb Gleb
commited on
Commit
·
e36aaa8
1
Parent(s):
00a217c
added debugging
Browse files
app.py
CHANGED
|
@@ -6,9 +6,14 @@ pipeline = SolrNormalizationPipeline()
|
|
| 6 |
LANGUAGES = ["Auto-detect", "de", "fr", "el", "ru"]
|
| 7 |
|
| 8 |
def normalize(text, lang_choice):
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
demo = gr.Interface(
|
| 14 |
fn=normalize,
|
|
|
|
| 6 |
LANGUAGES = ["Auto-detect", "de", "fr", "el", "ru"]
|
| 7 |
|
| 8 |
def normalize(text, lang_choice):
|
| 9 |
+
try:
|
| 10 |
+
lang = None if lang_choice == "Auto-detect" else lang_choice
|
| 11 |
+
result = pipeline(text, lang=lang, diagnostics=True)
|
| 12 |
+
return f"Language: {result['language']}\n\nTokens:\n{result['tokens']}\n\nDetected stopwords:\n{result['stopwords_detected']}"
|
| 13 |
+
except Exception as e:
|
| 14 |
+
print("❌ Pipeline error:", e)
|
| 15 |
+
return f"Error: {e}"
|
| 16 |
+
|
| 17 |
|
| 18 |
demo = gr.Interface(
|
| 19 |
fn=normalize,
|