serkang commited on
Commit
4eac0a1
·
verified ·
1 Parent(s): 8473ab8

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -0
app.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from datasets import load_dataset
2
+
3
+ # 1) Dataset yükle
4
+ ds = load_dataset("AlicanKiraz0/Cybersecurity-Dataset-Fenrir-v2.0", split="train")
5
+
6
+ # 2) Prompt-response formatına dönüştür
7
+ def format_example(example):
8
+ system = example.get("system", "")
9
+ user = example.get("user", "")
10
+ assistant = example.get("assistant", "")
11
+ text = f"<|system|>\n{system}\n<|user|>\n{user}\n<|assistant|>\n{assistant}"
12
+ return {"text": text}
13
+
14
+ ds = ds.map(format_example, remove_columns=ds.column_names)
15
+ print(ds[0])