kappashung commited on
Commit
c503e8d
1 Parent(s): a4e6ffd
app/__pycache__/main.cpython-310.pyc CHANGED
Binary files a/app/__pycache__/main.cpython-310.pyc and b/app/__pycache__/main.cpython-310.pyc differ
 
app/main.py CHANGED
@@ -36,10 +36,9 @@ def model_predict(text):
36
  return_attention_mask=True,
37
  return_tensors='pt')['input_ids']
38
  predictions = model(tokens).pooler_output.detach().numpy()[0]
39
- predictions.sort()
40
  output = {categories[idx]: str(round(prob * 100, 1)) + "%"
41
- for idx, prob in enumerate(predictions[::-1])}
42
- return output
43
 
44
 
45
  @app.get("/")
 
36
  return_attention_mask=True,
37
  return_tensors='pt')['input_ids']
38
  predictions = model(tokens).pooler_output.detach().numpy()[0]
 
39
  output = {categories[idx]: str(round(prob * 100, 1)) + "%"
40
+ for idx, prob in enumerate(predictions)}
41
+ return dict(sorted(output.items(), key=lambda item: -float(item[1][:-1])))
42
 
43
 
44
  @app.get("/")
templates/title_page.html CHANGED
@@ -36,7 +36,7 @@
36
  <form method="post">
37
  <div class="form-group">
38
  <label for="article_text">Enter article's text:</label>
39
- <input type="text" class="form-control" name="article_text" id="article_text" rows="6" placeholder="Something smart...'"></input>
40
  <small class="form-text hint">Click button below to proceed(it may take some time)</small>
41
  </div>
42
  <button type="submit" class="btn btn-primary">Analyse</button>
 
36
  <form method="post">
37
  <div class="form-group">
38
  <label for="article_text">Enter article's text:</label>
39
+ <textarea type="text" class="form-control" name="article_text" id="article_text" rows="8" placeholder="Something smart...'"></textarea>
40
  <small class="form-text hint">Click button below to proceed(it may take some time)</small>
41
  </div>
42
  <button type="submit" class="btn btn-primary">Analyse</button>