Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| # from transformers import pipeline | |
| # from datasets import load_dataset | |
| # Commented out until model & dataset are ready | |
| # model = pipeline("text-classification", model="Allsafeafrica/GreenGuard-AI-Defender") | |
| # dataset = load_dataset("Allsafeafrica/GreenGuard-Intel-Base") | |
| def greenguard_esg_analysis(text): | |
| # Placeholder response for now | |
| prediction = [{"label": "Low Threat", "score": 0.87}] | |
| return { | |
| "Model Output": prediction, | |
| "Threat Level": prediction[0]["label"] if prediction else "Unknown", | |
| "Confidence": f'{prediction[0]["score"]:.2f}' if prediction else "0.00" | |
| } | |
| with gr.Blocks(title="GreenGuardCyberAI") as demo: | |
| gr.Markdown( | |
| """ | |
| # ๐ก๏ธ GreenGuardCyberAI | |
| _AI-powered ESG Risk & Cyber Threat Analyzer by Allsafeafrica_ | |
| This tool scans cybersecurity documents, reports, or vendor data for: | |
| - ๐ Threat signals | |
| - ๐ ESG compliance gaps | |
| - ๐ก Risk-aware AI recommendations | |
| > โProtecting Africa's digital future with sustainable intelligence.โ ๐ | |
| """ | |
| ) | |
| with gr.Row(): | |
| input_text = gr.Textbox( | |
| label="Paste ESG/Cybersecurity Text or Report", | |
| placeholder="E.g. Third-party vendor failed to encrypt data..." | |
| ) | |
| output_json = gr.JSON(label="๐ง GreenGuard AI Analysis") | |
| analyze_btn = gr.Button("Run ESG Threat Analysis") | |
| analyze_btn.click(fn=greenguard_esg_analysis, inputs=input_text, outputs=output_json) | |
| # ๐ข Launch | |
| if __name__ == "__main__": | |
| demo.launch() | |