region:us
---
{}
---
from datasets import Dataset

# Prepare your data
data = [
    {"source_text": "Hello, how are you?", "target_text": "مرحبا كيف حالك؟"},
    {"source_text": "I am fine, thank you.", "target_text": "أنا بخHere's the complete code to prepare and upload a translation dataset to Hugging Face using the `datasets` library:

```python
from datasets import Dataset

# Prepare your data
data = [
    {"source_text": "Hello, how are you?", "target_text": "مرحبا كيف حالك؟"},
    {"source_text": "I am fine, thank you.", "target_text": "أنا بخير، شكراً لك."},
    {"source_text": "What is your name?", "target_text": "ما هو اسمك؟"},
    ...
]

# Convert your data into a format compatible with Hugging Face
dataset = Dataset.from_dict(data)
dataset = dataset.rename_column("source_text", "input_text")
dataset = dataset.rename_column("target_text", "target_text")

# Upload your data to Hugging Face
dataset.save_to_disk("translation_dataset")

---