Spaces:
Paused
Paused
| import gradio as gr | |
| import tempfile | |
| from inference.analyze import analyze | |
| from yara.generate import generate_yara | |
| def analyze_file(file): | |
| if file is None: | |
| return None, None | |
| path = file.name | |
| prompt = f"Suspicious file uploaded: {path}" | |
| result = analyze(prompt) | |
| yara = generate_yara(result) | |
| return result, yara | |
| with gr.Blocks() as demo: | |
| gr.Markdown("# 🛡️ MCMA – Malware Static Analyzer") | |
| file = gr.File(label="Drag & drop malware sample (static analysis only)") | |
| json_out = gr.JSON(label="Analysis Result") | |
| # CHANGED: language="yara" -> language="c" | |
| yara_out = gr.Code(label="Generated YARA Rule", language="c") | |
| btn = gr.Button("Analyze") | |
| btn.click(analyze_file, inputs=file, outputs=[json_out, yara_out]) | |
| demo.launch() |