Spaces:
Runtime error
Runtime error
File size: 1,021 Bytes
ed955bd 35746dd ed955bd 35746dd ed955bd 35746dd | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | import gradio as gr
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
# Model yükle
model_name = "kls123/CTI-llma3"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype=torch.float16,
device_map="auto"
)
def analyze_cve(prompt):
"""CVE analizi yap"""
inputs = tokenizer(prompt, return_tensors="pt")
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=512,
temperature=0.7,
do_sample=True
)
result = tokenizer.decode(outputs[0], skip_special_tokens=True)
return result
# Web arayüzü
demo = gr.Interface(
fn=analyze_cve,
inputs=gr.Textbox(label="CVE/Security Analysis Prompt", lines=5),
outputs=gr.Textbox(label="Analysis Result", lines=15),
title="🔒 CTI Llama3 Security Analyzer",
description="Cybersecurity threat analysis powered by fine-tuned Llama3"
)
demo.launch() |