Update app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
import os
|
|
|
|
| 2 |
from typing import Dict, Any
|
| 3 |
|
| 4 |
import gradio as gr
|
|
@@ -10,6 +11,7 @@ def predict(text: str) -> Dict[str, Any]:
|
|
| 10 |
"""Classify text for PII detection."""
|
| 11 |
if not text or text.strip() == "":
|
| 12 |
return {"No input provided": 0.0}
|
|
|
|
| 13 |
|
| 14 |
try:
|
| 15 |
# Tokenize input
|
|
@@ -52,6 +54,12 @@ examples = [
|
|
| 52 |
|
| 53 |
|
| 54 |
if __name__ == "__main__":
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
# Model configuration
|
| 56 |
model_id = "Roblox/roblox-pii-classifier"
|
| 57 |
|
|
@@ -101,4 +109,4 @@ if __name__ == "__main__":
|
|
| 101 |
flagging_mode="never",
|
| 102 |
)
|
| 103 |
|
| 104 |
-
demo.launch()
|
|
|
|
| 1 |
import os
|
| 2 |
+
import logging
|
| 3 |
from typing import Dict, Any
|
| 4 |
|
| 5 |
import gradio as gr
|
|
|
|
| 11 |
"""Classify text for PII detection."""
|
| 12 |
if not text or text.strip() == "":
|
| 13 |
return {"No input provided": 0.0}
|
| 14 |
+
logging.info(f"User input: {text}")
|
| 15 |
|
| 16 |
try:
|
| 17 |
# Tokenize input
|
|
|
|
| 54 |
|
| 55 |
|
| 56 |
if __name__ == "__main__":
|
| 57 |
+
logging.basicConfig(
|
| 58 |
+
level=logging.INFO,
|
| 59 |
+
format='%(asctime)s - %(levelname)s - %(message)s',
|
| 60 |
+
handlers=[logging.StreamHandler()]
|
| 61 |
+
)
|
| 62 |
+
|
| 63 |
# Model configuration
|
| 64 |
model_id = "Roblox/roblox-pii-classifier"
|
| 65 |
|
|
|
|
| 109 |
flagging_mode="never",
|
| 110 |
)
|
| 111 |
|
| 112 |
+
demo.launch()
|