ldhldh commited on
Commit
842eae5
β€’
1 Parent(s): 8ec6ea7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -0
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: