Download app.py from lifefake/Fruad: direct link, hf CLI and curl.
- Browser
- Download file 888 Bytes
-
https://huggingface.co/spaces/lifefake/Fruad/resolve/main/app.py
- Command line
-
hf download hf://spaces/lifefake/Fruad/app.py
-
curl -L -o app.py https://huggingface.co/spaces/lifefake/Fruad/resolve/main/app.py
888 Bytes
| # app.py → Gradio frontend | |
| import gradio as gr | |
| from backend_core import predict_from_text | |
| def ui_predict(text): | |
| response = predict_from_text(text) | |
| if isinstance(response, dict): | |
| if "error" in response: | |
| return f"ERROR: {response['error']}" | |
| if "prediction" in response: | |
| return response["prediction"] | |
| return str(response) | |
| with gr.Blocks() as demo: | |
| gr.Markdown("# 🔍 Fraud Detection Demo") | |
| gr.Markdown("Enter transaction details or text and get prediction from the ML model.") | |
| inp = gr.Textbox(label="Enter Transaction Text / Data", lines=3, placeholder="Type something...") | |
| out = gr.Textbox(label="Model Prediction") | |
| btn = gr.Button("Predict") | |
| btn.click(fn=ui_predict, inputs=inp, outputs=out) | |
| if __name__ == "__main__": | |
| demo.launch(server_name="0.0.0.0", server_port=7860) | |