Upload folder using huggingface_hub
Browse files- hate_speech_demo.py +10 -24
hate_speech_demo.py
CHANGED
|
@@ -148,20 +148,7 @@ body, .gradio-container {
|
|
| 148 |
border-bottom: 1px solid #eee;
|
| 149 |
font-family: 'All Round Gothic Demi', 'Poppins', sans-serif !important;
|
| 150 |
}
|
| 151 |
-
|
| 152 |
-
position: absolute;
|
| 153 |
-
top: 10px;
|
| 154 |
-
right: 10px;
|
| 155 |
-
padding: 5px 10px;
|
| 156 |
-
background: #f0f0f0;
|
| 157 |
-
border: none;
|
| 158 |
-
border-radius: 4px;
|
| 159 |
-
cursor: pointer;
|
| 160 |
-
font-size: 12px;
|
| 161 |
-
font-family: 'All Round Gothic Demi', 'Poppins', sans-serif !important;
|
| 162 |
-
}
|
| 163 |
-
.copy-button:hover {
|
| 164 |
-
background: #e0e0e0;
|
| 165 |
}
|
| 166 |
.orange-button {
|
| 167 |
background: #FCA539 !important;
|
|
@@ -566,13 +553,12 @@ def rate_user_input(user_input):
|
|
| 566 |
|
| 567 |
# Format contextual results with HTML styling - button comes AFTER the results
|
| 568 |
contextual_html = f"""
|
| 569 |
-
|
| 570 |
-
|
| 571 |
-
|
| 572 |
-
|
| 573 |
-
|
| 574 |
-
|
| 575 |
-
"""
|
| 576 |
|
| 577 |
return contextual_html, llama_html, openai_html, perspective_html, ""
|
| 578 |
|
|
@@ -854,7 +840,7 @@ def create_gradio_app():
|
|
| 854 |
# 🦙 LlamaGuard
|
| 855 |
gr.HTML("""
|
| 856 |
<div class="result-header" style="display: flex; align-items: center; gap: 10px;">
|
| 857 |
-
<span
|
| 858 |
<a href="https://github.com/meta-llama/PurpleLlama/blob/main/Llama-Guard3/8B/MODEL_CARD.md"
|
| 859 |
target="_blank" class="knowledge-button">View model card</a>
|
| 860 |
</div>
|
|
@@ -864,7 +850,7 @@ def create_gradio_app():
|
|
| 864 |
# 🧷 OpenAI Moderation
|
| 865 |
gr.HTML("""
|
| 866 |
<div class="result-header" style="display: flex; align-items: center; gap: 10px;">
|
| 867 |
-
<span
|
| 868 |
<a href="https://platform.openai.com/docs/guides/moderation"
|
| 869 |
target="_blank" class="knowledge-button">View model card</a>
|
| 870 |
</div>
|
|
@@ -874,7 +860,7 @@ def create_gradio_app():
|
|
| 874 |
# 🧩 Perspective API
|
| 875 |
gr.HTML("""
|
| 876 |
<div class="result-header" style="display: flex; align-items: center; gap: 10px;">
|
| 877 |
-
<span
|
| 878 |
<a href="https://developers.perspectiveapi.com/s/docs"
|
| 879 |
target="_blank" class="knowledge-button">View docs</a>
|
| 880 |
</div>
|
|
|
|
| 148 |
border-bottom: 1px solid #eee;
|
| 149 |
font-family: 'All Round Gothic Demi', 'Poppins', sans-serif !important;
|
| 150 |
}
|
| 151 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 152 |
}
|
| 153 |
.orange-button {
|
| 154 |
background: #FCA539 !important;
|
|
|
|
| 553 |
|
| 554 |
# Format contextual results with HTML styling - button comes AFTER the results
|
| 555 |
contextual_html = f"""
|
| 556 |
+
<div class="rating-box contextual-box {contextual_safety}-rating">
|
| 557 |
+
{contextual_rating}
|
| 558 |
+
</div>
|
| 559 |
+
{knowledge_button}
|
| 560 |
+
{knowledge_html}
|
| 561 |
+
"""
|
|
|
|
| 562 |
|
| 563 |
return contextual_html, llama_html, openai_html, perspective_html, ""
|
| 564 |
|
|
|
|
| 840 |
# 🦙 LlamaGuard
|
| 841 |
gr.HTML("""
|
| 842 |
<div class="result-header" style="display: flex; align-items: center; gap: 10px;">
|
| 843 |
+
<span>LlamaGuard 3.0</span>
|
| 844 |
<a href="https://github.com/meta-llama/PurpleLlama/blob/main/Llama-Guard3/8B/MODEL_CARD.md"
|
| 845 |
target="_blank" class="knowledge-button">View model card</a>
|
| 846 |
</div>
|
|
|
|
| 850 |
# 🧷 OpenAI Moderation
|
| 851 |
gr.HTML("""
|
| 852 |
<div class="result-header" style="display: flex; align-items: center; gap: 10px;">
|
| 853 |
+
<span>OpenAI Moderation</span>
|
| 854 |
<a href="https://platform.openai.com/docs/guides/moderation"
|
| 855 |
target="_blank" class="knowledge-button">View model card</a>
|
| 856 |
</div>
|
|
|
|
| 860 |
# 🧩 Perspective API
|
| 861 |
gr.HTML("""
|
| 862 |
<div class="result-header" style="display: flex; align-items: center; gap: 10px;">
|
| 863 |
+
<span>Perspective API</span>
|
| 864 |
<a href="https://developers.perspectiveapi.com/s/docs"
|
| 865 |
target="_blank" class="knowledge-button">View docs</a>
|
| 866 |
</div>
|