Spaces:
Runtime error
Runtime error
Check if file exists before attempting to remove
Browse files
perplexity_lenses/perplexity.py
CHANGED
@@ -11,7 +11,8 @@ class KenlmModel:
|
|
11 |
self.model = kenlm.Model(f"{language}.arpa.bin")
|
12 |
except OSError:
|
13 |
os.remove(f"{language}.arpa.bin")
|
14 |
-
os.
|
|
|
15 |
raise OSError("File was corrupt and should have been removed. Please, retry.")
|
16 |
|
17 |
@classmethod
|
|
|
11 |
self.model = kenlm.Model(f"{language}.arpa.bin")
|
12 |
except OSError:
|
13 |
os.remove(f"{language}.arpa.bin")
|
14 |
+
if os.path.exists(f"{language}.sp.model"):
|
15 |
+
os.remove(f"{language}.sp.model")
|
16 |
raise OSError("File was corrupt and should have been removed. Please, retry.")
|
17 |
|
18 |
@classmethod
|