djsull commited on
Commit
72d67dc
1 Parent(s): 7a78cc3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -6
app.py CHANGED
@@ -19,14 +19,17 @@ def predict(text):
19
  query = ' '.join(re.sub('[^가-힣a-zA-Z0-9 ]', ' ', query).split())
20
  result = cate_classifier(text)[0]
21
 
22
- res = {}
 
 
23
  for i in range(len(result)):
24
- if result[i]['score'] >= 0.5:
25
- label = result[i]['label']
26
- # res[f'{label}'] = 1
27
- res[f'{label}'] = int(result[i]['score'] * 10000) / 100
28
 
29
- return res
 
 
30
 
31
  gr.Interface(
32
  predict,
 
19
  query = ' '.join(re.sub('[^가-힣a-zA-Z0-9 ]', ' ', query).split())
20
  result = cate_classifier(text)[0]
21
 
22
+ ress = {}
23
+ ch = 0
24
+ chch = 0
25
  for i in range(len(result)):
26
+ if result[i]['score'] >= ch:
27
+ ch = result[i]['score']
28
+ chch = i
 
29
 
30
+ ress[f'{result[chch]["label"]}'] = int(result[chch]["score"] * 10000) / 100
31
+
32
+ return ress
33
 
34
  gr.Interface(
35
  predict,