Download app.py from Manav0603/project1: direct link, hf CLI and curl.
- Browser
- Download file 1.22 kB
-
https://huggingface.co/spaces/Manav0603/project1/resolve/main/app.py
- Command line
-
hf download hf://spaces/Manav0603/project1/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Manav0603/project1/resolve/main/app.py
1.22 kB
| import gradio as gr | |
| from main import analyze_input # Your backend function | |
| # Title + Description | |
| title = "Phishing Detector Chatbot" | |
| description = """ | |
| This tool analyzes links or email content and classifies them as **Malicious** or **Benign**. | |
| It also provides reasoning and mitigation tips. | |
| """ | |
| # Gradio UI Layout | |
| with gr.Blocks(theme=gr.themes.Soft(primary_hue="red", secondary_hue="blue")) as demo: | |
| gr.Markdown(f"# {title}") | |
| gr.Markdown(description) | |
| with gr.Row(): | |
| with gr.Column(scale=2): | |
| user_input = gr.Textbox( | |
| placeholder="Paste URL or email content here...", | |
| label="🔗 Input", | |
| lines=5 | |
| ) | |
| submit_btn = gr.Button("🚀 Submit", variant="primary") | |
| clear_btn = gr.Button("🧹 Clear") | |
| with gr.Column(scale=3): | |
| output = gr.JSON(label="📊 Result") | |
| # Bind actions | |
| submit_btn.click(analyze_input, inputs=user_input, outputs=output) | |
| clear_btn.click(lambda: ("", {}), inputs=None, outputs=[user_input, output]) | |
| # Launch (Spaces mein launch karne ke liye `server_name` aur `server_port` set karna zaroori nahi) | |
| if __name__ == "__main__": | |
| demo.launch() |