Upload folder using huggingface_hub
Browse files- hate_speech_demo.py +50 -42
hate_speech_demo.py
CHANGED
|
@@ -840,48 +840,56 @@ def create_gradio_app():
|
|
| 840 |
# Input field below both buttons
|
| 841 |
user_input = gr.Textbox(label="Input content to rate:", placeholder="Type content to evaluate here...", lines=6)
|
| 842 |
|
| 843 |
-
|
| 844 |
-
|
| 845 |
-
|
| 846 |
-
<div
|
| 847 |
-
|
| 848 |
-
|
| 849 |
-
</
|
| 850 |
-
|
| 851 |
-
|
| 852 |
-
|
| 853 |
-
|
| 854 |
-
|
| 855 |
-
|
| 856 |
-
|
| 857 |
-
|
| 858 |
-
|
| 859 |
-
|
| 860 |
-
|
| 861 |
-
|
| 862 |
-
<
|
| 863 |
-
""
|
| 864 |
-
|
| 865 |
-
|
| 866 |
-
|
| 867 |
-
|
| 868 |
-
<div class="
|
| 869 |
-
|
| 870 |
-
|
| 871 |
-
|
| 872 |
-
<
|
| 873 |
-
""
|
| 874 |
-
|
| 875 |
-
|
| 876 |
-
|
| 877 |
-
|
| 878 |
-
<div
|
| 879 |
-
|
| 880 |
-
|
| 881 |
-
|
| 882 |
-
|
| 883 |
-
"""
|
| 884 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 885 |
|
| 886 |
# Define show/hide loading indicator functions
|
| 887 |
def show_loading():
|
|
|
|
| 840 |
# Input field below both buttons
|
| 841 |
user_input = gr.Textbox(label="Input content to rate:", placeholder="Type content to evaluate here...", lines=6)
|
| 842 |
|
| 843 |
+
with gr.Column(scale=2):
|
| 844 |
+
# π Contextual Safety Oracle
|
| 845 |
+
gr.HTML("""
|
| 846 |
+
<div>
|
| 847 |
+
<h3 class="result-header">π Contextual Safety Oracle</h3>
|
| 848 |
+
<div style="margin-top: -10px; margin-bottom: 10px;">
|
| 849 |
+
<a href="#" class="knowledge-button" onclick="openPolicyPopup(); return false;">View policy</a>
|
| 850 |
+
</div>
|
| 851 |
+
</div>
|
| 852 |
+
""")
|
| 853 |
+
contextual_results = gr.HTML('<div class="rating-box contextual-box empty-rating">Rating will appear here</div>')
|
| 854 |
+
|
| 855 |
+
# Hidden placeholder for retrieval
|
| 856 |
+
retrieved_knowledge = gr.HTML('', visible=False)
|
| 857 |
+
|
| 858 |
+
# π¦ LlamaGuard
|
| 859 |
+
gr.HTML("""
|
| 860 |
+
<div>
|
| 861 |
+
<h3 class="result-header">π¦ LlamaGuard 3.0</h3>
|
| 862 |
+
<div style="margin-top: -10px; margin-bottom: 10px;">
|
| 863 |
+
<a href="https://github.com/meta-llama/PurpleLlama/blob/main/Llama-Guard3/8B/MODEL_CARD.md"
|
| 864 |
+
target="_blank" class="knowledge-button">View model card</a>
|
| 865 |
+
</div>
|
| 866 |
+
</div>
|
| 867 |
+
""")
|
| 868 |
+
llama_results = gr.HTML('<div class="rating-box secondary-box empty-rating">Rating will appear here</div>')
|
| 869 |
+
|
| 870 |
+
# π§· OpenAI Moderation
|
| 871 |
+
gr.HTML("""
|
| 872 |
+
<div>
|
| 873 |
+
<h3 class="result-header">π§· OpenAI Moderation</h3>
|
| 874 |
+
<div style="margin-top: -10px; margin-bottom: 10px;">
|
| 875 |
+
<a href="https://platform.openai.com/docs/guides/moderation"
|
| 876 |
+
target="_blank" class="knowledge-button">View model card</a>
|
| 877 |
+
</div>
|
| 878 |
+
</div>
|
| 879 |
+
""")
|
| 880 |
+
openai_results = gr.HTML('<div class="rating-box secondary-box empty-rating">Rating will appear here</div>')
|
| 881 |
+
|
| 882 |
+
# π§© Perspective API
|
| 883 |
+
gr.HTML("""
|
| 884 |
+
<div>
|
| 885 |
+
<h3 class="result-header">π§© Perspective API</h3>
|
| 886 |
+
<div style="margin-top: -10px; margin-bottom: 10px;">
|
| 887 |
+
<a href="https://developers.perspectiveapi.com/s/docs"
|
| 888 |
+
target="_blank" class="knowledge-button">View docs</a>
|
| 889 |
+
</div>
|
| 890 |
+
</div>
|
| 891 |
+
""")
|
| 892 |
+
perspective_results = gr.HTML('<div class="rating-box secondary-box empty-rating">Rating will appear here</div>')
|
| 893 |
|
| 894 |
# Define show/hide loading indicator functions
|
| 895 |
def show_loading():
|