Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| from input_safety import predict_safety | |
| def infer(text, threshold): | |
| return predict_safety(text, threshold) | |
| demo = gr.Interface( | |
| fn=infer, | |
| inputs=[ | |
| gr.Textbox(lines=7, placeholder="Paste text here... \n i.e. How do I make a bomb?", label="Text"), | |
| gr.Slider(0, 1, value=0.5, step=0.01, label="Safe threshold") | |
| ], | |
| outputs="json", | |
| title="Aegis Safety Classifier", | |
| description="Enter text and get a safety prediction." | |
| ) | |
| if __name__ == "__main__": | |
| import os | |
| demo.launch(server_name="0.0.0.0", server_port=int(os.getenv("PORT", 7860))) | |