File size: 755 Bytes
ce96a8b 342b720 ce96a8b 342b720 ce96a8b 342b720 ce96a8b 342b720 |
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 |
from datasets import Dataset
from huggingface_hub import login
import json
# Load and process JSON data
with open("norwegian_medical_qa_v2.json") as f:
raw_data = json.load(f)
# Transform the data
processed_data = []
for item in raw_data:
wrong_answers = item["wrong_answers_text"]
# wrong_answers= [ans.strip() for ans in wrong_answers_raw.split(";")]
processed_data.append({
"question": item["question_text"],
"answer": item["answer_text"],
"wrong_answers": wrong_answers,
"source_file": item["source_file"],
"question_number": item["question_number"]
})
# Create Hugging Face Dataset
dataset = Dataset.from_list(processed_data)
# Push to the Hub
dataset.push_to_hub("SimulaMet/NorMedQA")
|