[update]add model
Browse files
main.py
CHANGED
@@ -41,11 +41,16 @@ examples = [
|
|
41 |
]
|
42 |
|
43 |
|
44 |
-
def
|
45 |
result = "{}{}".format(match.group(1), match.group(2))
|
46 |
return result
|
47 |
|
48 |
|
|
|
|
|
|
|
|
|
|
|
49 |
def main():
|
50 |
args = get_args()
|
51 |
|
@@ -105,18 +110,23 @@ def main():
|
|
105 |
|
106 |
output_ = output_.replace("[UNK] ", "")
|
107 |
output_ = output_.replace("[UNK]", "")
|
|
|
|
|
108 |
|
109 |
output += output_
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
|
111 |
-
output = output.
|
112 |
output = output.replace("[SEP]", "\n")
|
113 |
-
output = re.sub(r"([,。!?\u4e00-\u9fa5]) ([,。!?\u4e00-\u9fa5])", repl, output)
|
114 |
-
output = output.strip()
|
115 |
|
116 |
-
output_text_box.value += output
|
117 |
yield output
|
118 |
|
119 |
-
model_name_choices = ["trained_models/lib_service_4chan"] \
|
120 |
if platform.system() == "Windows" else \
|
121 |
["qgyd2021/lib_service_4chan", "qgyd2021/chinese_chitchat", "qgyd2021/chinese_porn_novel"]
|
122 |
|
@@ -135,8 +145,8 @@ def main():
|
|
135 |
examples=[
|
136 |
["怎样擦屁股才能擦的干净", 512, 0.75, 0.35, 1.2, "qgyd2021/lib_service_4chan", True],
|
137 |
["你好", 512, 0.75, 0.35, 1.2, "qgyd2021/chinese_chitchat", True],
|
138 |
-
["白洁走到床边并脱去内衣, 一双硕大的", 512, 0.75, 0.35, 1.
|
139 |
-
["男人走进房间, 上床, 压上", 512, 0.75, 0.35, 1.
|
140 |
],
|
141 |
cache_examples=False,
|
142 |
examples_per_page=50,
|
|
|
41 |
]
|
42 |
|
43 |
|
44 |
+
def repl1(match):
|
45 |
result = "{}{}".format(match.group(1), match.group(2))
|
46 |
return result
|
47 |
|
48 |
|
49 |
+
def repl2(match):
|
50 |
+
result = "{}".format(match.group(1))
|
51 |
+
return result
|
52 |
+
|
53 |
+
|
54 |
def main():
|
55 |
args = get_args()
|
56 |
|
|
|
110 |
|
111 |
output_ = output_.replace("[UNK] ", "")
|
112 |
output_ = output_.replace("[UNK]", "")
|
113 |
+
output_ = output_.replace("[CLS] ", "")
|
114 |
+
output_ = output_.replace("[CLS]", "")
|
115 |
|
116 |
output += output_
|
117 |
+
if output.startswith("[SEP]"):
|
118 |
+
output = output[5:]
|
119 |
+
|
120 |
+
output = output.lstrip(" ,.!?")
|
121 |
+
output = re.sub(r"([,。!?\u4e00-\u9fa5]) ([,。!?\u4e00-\u9fa5])", repl1, output)
|
122 |
+
output = re.sub(r"([,。!?\u4e00-\u9fa5]) ", repl2, output)
|
123 |
|
124 |
+
output = output.replace("[SEP] ", "\n")
|
125 |
output = output.replace("[SEP]", "\n")
|
|
|
|
|
126 |
|
|
|
127 |
yield output
|
128 |
|
129 |
+
model_name_choices = ["trained_models/lib_service_4chan", "trained_models/chinese_porn_novel"] \
|
130 |
if platform.system() == "Windows" else \
|
131 |
["qgyd2021/lib_service_4chan", "qgyd2021/chinese_chitchat", "qgyd2021/chinese_porn_novel"]
|
132 |
|
|
|
145 |
examples=[
|
146 |
["怎样擦屁股才能擦的干净", 512, 0.75, 0.35, 1.2, "qgyd2021/lib_service_4chan", True],
|
147 |
["你好", 512, 0.75, 0.35, 1.2, "qgyd2021/chinese_chitchat", True],
|
148 |
+
["白洁走到床边并脱去内衣, 一双硕大的", 512, 0.75, 0.35, 1.8, "qgyd2021/chinese_porn_novel", False],
|
149 |
+
["男人走进房间, 上床, 压上", 512, 0.75, 0.35, 1.8, "qgyd2021/chinese_porn_novel", False],
|
150 |
],
|
151 |
cache_examples=False,
|
152 |
examples_per_page=50,
|