Datasets:
Upload reddit_climate_comment.py
Browse files
reddit_climate_comment.py
CHANGED
|
@@ -5,6 +5,7 @@ from datasets import GeneratorBasedBuilder, Features, Value, Sequence, SplitGene
|
|
| 5 |
import logging
|
| 6 |
import pandas as pd
|
| 7 |
from typing import Dict
|
|
|
|
| 8 |
|
| 9 |
CITATION = ""
|
| 10 |
_DESCRIPTION = "Demo"
|
|
@@ -24,7 +25,7 @@ class NewDataset(GeneratorBasedBuilder):
|
|
| 24 |
"post_author": Value("string"),
|
| 25 |
"post_body": Value("string"),
|
| 26 |
"post_url": Value("string"),
|
| 27 |
-
"post_pic":
|
| 28 |
"subreddit": Value("string"),
|
| 29 |
"post_timestamp": Value("string"),
|
| 30 |
"post_upvotes": Value("int32"),
|
|
@@ -68,6 +69,7 @@ class NewDataset(GeneratorBasedBuilder):
|
|
| 68 |
post_body = post_data['PostBody']
|
| 69 |
post_url = post_data['PostUrl']
|
| 70 |
post_pic = post_data['PostPic']
|
|
|
|
| 71 |
subreddit = post_data['Subreddit']
|
| 72 |
post_timestamp = post_data['PostTimestamp']
|
| 73 |
post_upvotes = post_data['PostUpvotes']
|
|
|
|
| 5 |
import logging
|
| 6 |
import pandas as pd
|
| 7 |
from typing import Dict
|
| 8 |
+
from datasets import Image
|
| 9 |
|
| 10 |
CITATION = ""
|
| 11 |
_DESCRIPTION = "Demo"
|
|
|
|
| 25 |
"post_author": Value("string"),
|
| 26 |
"post_body": Value("string"),
|
| 27 |
"post_url": Value("string"),
|
| 28 |
+
"post_pic": Image(),
|
| 29 |
"subreddit": Value("string"),
|
| 30 |
"post_timestamp": Value("string"),
|
| 31 |
"post_upvotes": Value("int32"),
|
|
|
|
| 69 |
post_body = post_data['PostBody']
|
| 70 |
post_url = post_data['PostUrl']
|
| 71 |
post_pic = post_data['PostPic']
|
| 72 |
+
post_pic = Image.from_path(post_pic)
|
| 73 |
subreddit = post_data['Subreddit']
|
| 74 |
post_timestamp = post_data['PostTimestamp']
|
| 75 |
post_upvotes = post_data['PostUpvotes']
|