Spaces:
Runtime error
Runtime error
Commit
·
4e65c30
1
Parent(s):
0460b2c
fix
Browse files
app.py
CHANGED
|
@@ -100,7 +100,7 @@ def predict(s1, s2, chosen_model):
|
|
| 100 |
with torch.no_grad():
|
| 101 |
output = model(**model_input)
|
| 102 |
logits = output[0][0].detach().numpy()
|
| 103 |
-
|
| 104 |
break
|
| 105 |
def get_description(idx):
|
| 106 |
description = score_descriptions[idx]
|
|
@@ -108,9 +108,12 @@ def predict(s1, s2, chosen_model):
|
|
| 108 |
final_description = description + "\n \n" + description_pt
|
| 109 |
return final_description
|
| 110 |
|
| 111 |
-
|
|
|
|
|
|
|
|
|
|
| 112 |
|
| 113 |
-
return
|
| 114 |
|
| 115 |
|
| 116 |
inputs = [
|
|
@@ -120,7 +123,7 @@ inputs = [
|
|
| 120 |
]
|
| 121 |
|
| 122 |
outputs = [
|
| 123 |
-
gr.
|
| 124 |
]
|
| 125 |
|
| 126 |
|
|
|
|
| 100 |
with torch.no_grad():
|
| 101 |
output = model(**model_input)
|
| 102 |
logits = output[0][0].detach().numpy()
|
| 103 |
+
score = logits[0]
|
| 104 |
break
|
| 105 |
def get_description(idx):
|
| 106 |
description = score_descriptions[idx]
|
|
|
|
| 108 |
final_description = description + "\n \n" + description_pt
|
| 109 |
return final_description
|
| 110 |
|
| 111 |
+
round_score = round(score)
|
| 112 |
+
score_percentage = min(score,5) / 5
|
| 113 |
+
score_percentage = '{:,.2%}'.format(score_percentage)
|
| 114 |
+
description = get_description(round_score).format(score_percentage)
|
| 115 |
|
| 116 |
+
return description
|
| 117 |
|
| 118 |
|
| 119 |
inputs = [
|
|
|
|
| 123 |
]
|
| 124 |
|
| 125 |
outputs = [
|
| 126 |
+
gr.Textbox(label="Result")
|
| 127 |
]
|
| 128 |
|
| 129 |
|