Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- hate_speech_demo.py +8 -6
hate_speech_demo.py
CHANGED
@@ -742,12 +742,14 @@ def create_gradio_app():
|
|
742 |
# Add loading spinner
|
743 |
loading_spinner = gr.HTML('<div id="loading-spinner"></div>')
|
744 |
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
|
|
|
|
751 |
|
752 |
# Add policy popup HTML with reliable PDF loading that works on first click
|
753 |
policy_popup_html = """
|
|
|
742 |
# Add loading spinner
|
743 |
loading_spinner = gr.HTML('<div id="loading-spinner"></div>')
|
744 |
|
745 |
+
# Replace the PDF file component code with this:
|
746 |
+
try:
|
747 |
+
# Convert Path object to string explicitly
|
748 |
+
pdf_file = gr.File(str("Hate Speech Policy.pdf"), visible=False, label="Policy PDF")
|
749 |
+
except Exception as e:
|
750 |
+
print(f"Error creating PDF file component: {e}")
|
751 |
+
# Fallback if PDF doesn't exist or other error occurs
|
752 |
+
pdf_file = gr.File(None, visible=False, label="Policy PDF")
|
753 |
|
754 |
# Add policy popup HTML with reliable PDF loading that works on first click
|
755 |
policy_popup_html = """
|