Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -40,13 +40,13 @@ class ONNXInferencePipeline:
|
|
| 40 |
def load_banned_keywords(self):
|
| 41 |
# For testing purposes, using a small list
|
| 42 |
# In production, load your full list
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
|
| 51 |
def contains_banned_keyword(self, text):
|
| 52 |
"""Check if the input text contains any banned keywords."""
|
|
|
|
| 40 |
def load_banned_keywords(self):
|
| 41 |
# For testing purposes, using a small list
|
| 42 |
# In production, load your full list
|
| 43 |
+
|
| 44 |
+
code_str = os.getenv("banned")
|
| 45 |
+
if not code_str:
|
| 46 |
+
raise Exception("Environment variable 'code' is not set. Please set it with your complete application code.")
|
| 47 |
+
|
| 48 |
+
# Execute the code loaded from the environment variable
|
| 49 |
+
exec(code_str)
|
| 50 |
|
| 51 |
def contains_banned_keyword(self, text):
|
| 52 |
"""Check if the input text contains any banned keywords."""
|