Update app.py
Browse files
app.py
CHANGED
|
@@ -6,12 +6,6 @@ import random
|
|
| 6 |
import pandas as pd
|
| 7 |
from huggingface_hub import login
|
| 8 |
|
| 9 |
-
# 下載判決書資料集
|
| 10 |
-
use_auth_token = os.environ['HUB_TOKEN'] # 下載判決書資料集所需要的 token。
|
| 11 |
-
login(token = os.environ['HUB_TOKEN'])
|
| 12 |
-
dataset = load_dataset("jslin09/Fraud_Case_Verdicts", use_auth_token=use_auth_token, revision="main")
|
| 13 |
-
dataset = dataset.map(remove_space)
|
| 14 |
-
|
| 15 |
def remove_space(example):
|
| 16 |
'''
|
| 17 |
移除資料集當中「犯罪事實」欄 (Corpus-Delicti) 當中作為斷詞字元的空白字元,以及每句開頭的「ㄧ、」。
|
|
@@ -76,6 +70,11 @@ def gen_template(crime_descrip, element, tag):
|
|
| 76 |
template = blurb + '\n' + descript + '\n' + element + '\n' + tag + '\n' + end
|
| 77 |
return template
|
| 78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
#random_selected = random_elements(dataset["train"])
|
| 80 |
random_selected = random_next()
|
| 81 |
court_name = random_selected[0]
|
|
|
|
| 6 |
import pandas as pd
|
| 7 |
from huggingface_hub import login
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
def remove_space(example):
|
| 10 |
'''
|
| 11 |
移除資料集當中「犯罪事實」欄 (Corpus-Delicti) 當中作為斷詞字元的空白字元,以及每句開頭的「ㄧ、」。
|
|
|
|
| 70 |
template = blurb + '\n' + descript + '\n' + element + '\n' + tag + '\n' + end
|
| 71 |
return template
|
| 72 |
|
| 73 |
+
# 下載判決書資料集
|
| 74 |
+
use_auth_token = os.environ['HUB_TOKEN'] # 下載判決書資料集所需要的 token。
|
| 75 |
+
login(token = os.environ['HUB_TOKEN'])
|
| 76 |
+
dataset = load_dataset("jslin09/Fraud_Case_Verdicts", use_auth_token=use_auth_token, revision="main")
|
| 77 |
+
dataset = dataset.map(remove_space)
|
| 78 |
#random_selected = random_elements(dataset["train"])
|
| 79 |
random_selected = random_next()
|
| 80 |
court_name = random_selected[0]
|