Downloads · 30 days
0
saudaloufi12/translate
translate is a machine learning model from saudaloufi12. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Downloads · 30 days
0
Access
Public
Updated May 25, 2023
Repo size
—
Likes
1
Public
Click a slice to open those files.
Other1.5 KB · 60%
From the Hugging Face model README
from datasets import Dataset
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:
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")
---