saudaloufi12 commited on
Commit
53bbcda
1 Parent(s): 4d17e32
Files changed (1) hide show
  1. README.md +25 -6
README.md CHANGED
@@ -1,8 +1,27 @@
1
- ---
2
- license: openrail
3
- language:
4
- - ar
5
- tags:
6
- - code
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
 
8
  ---
 
1
+ from datasets import Dataset
2
+
3
+ # Prepare your data
4
+ data = [
5
+ {"source_text": "Hello, how are you?", "target_text": "مرحبا كيف حالك؟"},
6
+ {"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:
7
+
8
+ ```python
9
+ from datasets import Dataset
10
+
11
+ # Prepare your data
12
+ data = [
13
+ {"source_text": "Hello, how are you?", "target_text": "مرحبا كيف حالك؟"},
14
+ {"source_text": "I am fine, thank you.", "target_text": "أنا بخير، شكراً لك."},
15
+ {"source_text": "What is your name?", "target_text": "ما هو اسمك؟"},
16
+ ...
17
+ ]
18
+
19
+ # Convert your data into a format compatible with Hugging Face
20
+ dataset = Dataset.from_dict(data)
21
+ dataset = dataset.rename_column("source_text", "input_text")
22
+ dataset = dataset.rename_column("target_text", "target_text")
23
+
24
+ # Upload your data to Hugging Face
25
+ dataset.save_to_disk("translation_dataset")
26
 
27
  ---