Spaces:
Sleeping
Sleeping
kappashung
commited on
Commit
•
c503e8d
1
Parent(s):
a4e6ffd
fixes
Browse files- app/__pycache__/main.cpython-310.pyc +0 -0
- app/main.py +2 -3
- templates/title_page.html +1 -1
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
|
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 |
-
<
|
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>
|