Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -129,6 +129,15 @@ Cat์ ํ๊ฐ ๋๋ฉด ๋ฐํฑ์ผ๋ก ํ ํ
๋๋ค.
|
|
| 129 |
]]""",
|
| 130 |
}
|
| 131 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 132 |
|
| 133 |
def check(model_name):
|
| 134 |
data = requests.get("https://health.petals.dev/api/v1/state").json()
|
|
@@ -207,6 +216,7 @@ def chat(id, npc, text):
|
|
| 207 |
inputs = tokenizer(prom, return_tensors="pt")["input_ids"]
|
| 208 |
outputs = model.generate(inputs, do_sample=True, temperature=0.6, top_p=0.75, max_new_tokens=100)
|
| 209 |
output = tokenizer.decode(outputs[0])[len(prom)+3:-1].split("<")[0].split("###")[0].replace(". ", ".\n")
|
|
|
|
| 210 |
print(tokenizer.decode(outputs[0]))
|
| 211 |
print(output)
|
| 212 |
else:
|
|
|
|
| 129 |
]]""",
|
| 130 |
}
|
| 131 |
|
| 132 |
+
|
| 133 |
+
def cleanText(readData):
|
| 134 |
+
|
| 135 |
+
#ํ
์คํธ์ ํฌํจ๋์ด ์๋ ํน์ ๋ฌธ์ ์ ๊ฑฐ
|
| 136 |
+
|
| 137 |
+
text = re.sub('[-=+#/\:^$@*\"โป&%ใใ\\โ|\(\)\[\]\<\>`\'ใ]','', readData)
|
| 138 |
+
|
| 139 |
+
return text
|
| 140 |
+
|
| 141 |
|
| 142 |
def check(model_name):
|
| 143 |
data = requests.get("https://health.petals.dev/api/v1/state").json()
|
|
|
|
| 216 |
inputs = tokenizer(prom, return_tensors="pt")["input_ids"]
|
| 217 |
outputs = model.generate(inputs, do_sample=True, temperature=0.6, top_p=0.75, max_new_tokens=100)
|
| 218 |
output = tokenizer.decode(outputs[0])[len(prom)+3:-1].split("<")[0].split("###")[0].replace(". ", ".\n")
|
| 219 |
+
output = cleanText(output)
|
| 220 |
print(tokenizer.decode(outputs[0]))
|
| 221 |
print(output)
|
| 222 |
else:
|