BeMerciless commited on
Commit
eade612
·
1 Parent(s): 0209fbc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -5
app.py CHANGED
@@ -5,10 +5,14 @@ from transformers import AutoTokenizer
5
  #def greet(name):
6
  # return "Hello " + name + "!!"
7
 
8
- def greet(sent):
9
-
10
  print("input_sent= " + sent)
11
- pt_model = 'best.pt'
 
 
 
 
 
12
  print(pt_model)
13
  device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
14
  print("device:",device)
@@ -53,6 +57,7 @@ def greet(sent):
53
  result= sent + ">> 악의적인 내용이 보이지 않습니다."
54
 
55
  return result
56
-
57
- iface = gr.Interface(fn=greet,title='Korean malicious comment',description="한국어 악플 판별기",inputs="text", outputs="text")
 
58
  iface.launch()
 
5
  #def greet(name):
6
  # return "Hello " + name + "!!"
7
 
8
+ def greet(sent,mode):
 
9
  print("input_sent= " + sent)
10
+ if mode=='Malicious_comment':
11
+ pt_model ='best.pt'
12
+ if mode=='Economic_article':
13
+ pt_model ='best2.pt'
14
+
15
+
16
  print(pt_model)
17
  device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
18
  print("device:",device)
 
57
  result= sent + ">> 악의적인 내용이 보이지 않습니다."
58
 
59
  return result
60
+ intput="text"
61
+ input2= gr.Dropdown(choices=['Malicious_comment','Economic_article'])
62
+ iface = gr.Interface(fn=greet,title='Korean malicious comment',description="한국어 악플 판별기",inputs=[intput,input2], outputs="text")
63
  iface.launch()