Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -19,8 +19,8 @@ except ImportError:
|
|
19 |
logging.info("PEFT library not found. Loading models without PEFT support.")
|
20 |
|
21 |
# --- Configuration ---
|
22 |
-
# Model path is set to
|
23 |
-
MODEL_PATH = os.getenv("MODEL_PATH", "
|
24 |
DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
|
25 |
LABELS = ["self-harm", "hate", "vulgar", "sex", "crime"]
|
26 |
MAX_SEQ_LENGTH = 512
|
@@ -133,13 +133,12 @@ def gradio_predict(text: str) -> Tuple[str, Dict[str, float]]:
|
|
133 |
verdict = "✅ Komunikat jest bezpieczny."
|
134 |
else:
|
135 |
highest_unsafe_category = max(unsafe_categories, key=unsafe_categories.get)
|
136 |
-
verdict = f"⚠️ Wykryto potencjalnie szkodliwe treści
|
137 |
|
138 |
return verdict, predictions
|
139 |
|
140 |
# --- Gradio Interface ---
|
141 |
|
142 |
-
# Custom theme inspired by the provided image - THIS IS THE CORRECTED LINE
|
143 |
theme = gr.themes.Default(
|
144 |
primary_hue=gr.themes.colors.blue,
|
145 |
secondary_hue=gr.themes.colors.indigo,
|
@@ -187,7 +186,7 @@ with gr.Blocks(theme=theme, css=".gradio-container {max-width: 960px !important;
|
|
187 |
Bielik Guard
|
188 |
</p>
|
189 |
<h1 style="font-size: 2.8rem; font-weight: 800; line-height: 1.2; margin-top: 1rem; margin-bottom: 1rem; color: var(--neutral-800);">
|
190 |
-
|
191 |
</h1>
|
192 |
<p style="font-size: 1rem; color: var(--neutral-600); margin-bottom: 2rem;">
|
193 |
Sójka to model AI, który wykrywa i blokuje szkodliwe treści w komunikacji cyfrowej. Chroni użytkowników jak czujny strażnik swoich domów.
|
|
|
19 |
logging.info("PEFT library not found. Loading models without PEFT support.")
|
20 |
|
21 |
# --- Configuration ---
|
22 |
+
# Model path is set to sojka
|
23 |
+
MODEL_PATH = os.getenv("MODEL_PATH", "AndromedaPL/sojka")
|
24 |
DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
|
25 |
LABELS = ["self-harm", "hate", "vulgar", "sex", "crime"]
|
26 |
MAX_SEQ_LENGTH = 512
|
|
|
133 |
verdict = "✅ Komunikat jest bezpieczny."
|
134 |
else:
|
135 |
highest_unsafe_category = max(unsafe_categories, key=unsafe_categories.get)
|
136 |
+
verdict = f"⚠️ Wykryto potencjalnie szkodliwe treści\n: {highest_unsafe_category.upper()}"
|
137 |
|
138 |
return verdict, predictions
|
139 |
|
140 |
# --- Gradio Interface ---
|
141 |
|
|
|
142 |
theme = gr.themes.Default(
|
143 |
primary_hue=gr.themes.colors.blue,
|
144 |
secondary_hue=gr.themes.colors.indigo,
|
|
|
186 |
Bielik Guard
|
187 |
</p>
|
188 |
<h1 style="font-size: 2.8rem; font-weight: 800; line-height: 1.2; margin-top: 1rem; margin-bottom: 1rem; color: var(--neutral-800);">
|
189 |
+
Przetestuj <span style="color: var(--primary-600);">SÓJKĘ</span> – Bielik Guard dla bezpiecznej komunikacji
|
190 |
</h1>
|
191 |
<p style="font-size: 1rem; color: var(--neutral-600); margin-bottom: 2rem;">
|
192 |
Sójka to model AI, który wykrywa i blokuje szkodliwe treści w komunikacji cyfrowej. Chroni użytkowników jak czujny strażnik swoich domów.
|