Spaces:
Runtime error
Runtime error
Commit ·
03eba51
1
Parent(s): e2afe19
Fixing port issue (again)
Browse files- README.md +0 -2
- gradio_app.py +12 -3
- requirements.txt +1 -0
README.md
CHANGED
|
@@ -7,6 +7,4 @@ sdk: gradio
|
|
| 7 |
sdk_version: "5.11.0"
|
| 8 |
app_file: gradio_app.py
|
| 9 |
pinned: true
|
| 10 |
-
ports:
|
| 11 |
-
- 7860
|
| 12 |
---
|
|
|
|
| 7 |
sdk_version: "5.11.0"
|
| 8 |
app_file: gradio_app.py
|
| 9 |
pinned: true
|
|
|
|
|
|
|
| 10 |
---
|
gradio_app.py
CHANGED
|
@@ -579,8 +579,17 @@ with gr.Blocks(css=custom_css, theme=gr.themes.Soft()) as iface:
|
|
| 579 |
""")
|
| 580 |
|
| 581 |
if __name__ == "__main__":
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 582 |
iface.launch(
|
| 583 |
-
|
| 584 |
-
|
| 585 |
-
|
| 586 |
)
|
|
|
|
| 579 |
""")
|
| 580 |
|
| 581 |
if __name__ == "__main__":
|
| 582 |
+
iface = gr.Interface(
|
| 583 |
+
fn=analyze_content,
|
| 584 |
+
inputs=gr.Textbox(lines=8, label="Input Text"),
|
| 585 |
+
outputs=gr.JSON(),
|
| 586 |
+
title="Content Trigger Analysis",
|
| 587 |
+
description="Analyze text content for sensitive topics and trigger warnings"
|
| 588 |
+
)
|
| 589 |
+
|
| 590 |
+
# Use Hugging Face Spaces environment variable for port
|
| 591 |
iface.launch(
|
| 592 |
+
server_name="0.0.0.0",
|
| 593 |
+
server_port=int(os.environ.get("PORT", 7860)),
|
| 594 |
+
share=True
|
| 595 |
)
|
requirements.txt
CHANGED
|
@@ -7,4 +7,5 @@ accelerate
|
|
| 7 |
safetensors
|
| 8 |
huggingface-hub
|
| 9 |
beautifulsoup4
|
|
|
|
| 10 |
fastapi
|
|
|
|
| 7 |
safetensors
|
| 8 |
huggingface-hub
|
| 9 |
beautifulsoup4
|
| 10 |
+
protobuf
|
| 11 |
fastapi
|