mdj1412 commited on
Commit
917f1e0
1 Parent(s): 6460d80

Update app.py "Any" -> "Default"

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -16,7 +16,7 @@ label2id = {"NEGATIVE": 0, "POSITIVE": 1}
16
  title = "Movie Review Score Discriminator"
17
  description = "It is a program that classifies whether it is positive or negative by entering movie reviews. \
18
  You can choose between the Korean version and the English version. \
19
- It also provides a version called Any, which determines whether it is Korean or English and predicts it."
20
 
21
 
22
  class LanguageIdentification:
@@ -81,7 +81,7 @@ def builder(lang, text):
81
 
82
 
83
  # [ output_1 ]
84
- if lang == 'Any':
85
  pred = LANGUAGE.predict_lang(text)
86
  if '__label__en' in pred[0]:
87
  lang = 'Eng'
@@ -138,6 +138,7 @@ def builder(lang, text):
138
  else:
139
  output_analysis.append( (word, None) )
140
 
 
141
  return [ {'Kor': percent_kor, 'Eng': percent_eng, 'Other': 1-(percent_kor+percent_eng)},
142
  {id2label[1]: output[0][1].item(), id2label[0]: output[0][0].item()},
143
  output_analysis ]
@@ -153,7 +154,7 @@ def builder(lang, text):
153
 
154
 
155
 
156
- demo = gr.Interface(builder, inputs=[gr.inputs.Dropdown(['Any', 'Eng', 'Kor']), "text"],
157
  outputs=[ gr.Label(num_top_classes=3, label='Lang'),
158
  gr.Label(num_top_classes=2, label='Result'),
159
  gr.HighlightedText(label="Analysis", combine_adjacent=False)
 
16
  title = "Movie Review Score Discriminator"
17
  description = "It is a program that classifies whether it is positive or negative by entering movie reviews. \
18
  You can choose between the Korean version and the English version. \
19
+ It also provides a version called ""Default"", which determines whether it is Korean or English and predicts it."
20
 
21
 
22
  class LanguageIdentification:
 
81
 
82
 
83
  # [ output_1 ]
84
+ if lang == 'Default':
85
  pred = LANGUAGE.predict_lang(text)
86
  if '__label__en' in pred[0]:
87
  lang = 'Eng'
 
138
  else:
139
  output_analysis.append( (word, None) )
140
 
141
+
142
  return [ {'Kor': percent_kor, 'Eng': percent_eng, 'Other': 1-(percent_kor+percent_eng)},
143
  {id2label[1]: output[0][1].item(), id2label[0]: output[0][0].item()},
144
  output_analysis ]
 
154
 
155
 
156
 
157
+ demo = gr.Interface(builder, inputs=[gr.inputs.Dropdown(['Default', 'Eng', 'Kor']), "text"],
158
  outputs=[ gr.Label(num_top_classes=3, label='Lang'),
159
  gr.Label(num_top_classes=2, label='Result'),
160
  gr.HighlightedText(label="Analysis", combine_adjacent=False)