Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -26,31 +26,30 @@ if st.button("Predict"):
|
|
26 |
|
27 |
# Extract the predictions
|
28 |
predictions = outputs.logits.squeeze()
|
29 |
-
|
30 |
# Convert to numpy array if necessary
|
31 |
predicted_scores = predictions.numpy()
|
32 |
-
|
33 |
-
# Apply a significant uniform reduction (e.g., reduce by
|
34 |
-
reduction_factor = 0.
|
35 |
adjusted_scores = predicted_scores * reduction_factor
|
36 |
-
|
37 |
# Ensure scores do not go below zero
|
38 |
adjusted_scores = np.maximum(adjusted_scores, 0)
|
39 |
-
|
40 |
# Normalize the scores to ensure they fall within the 0-9 range
|
41 |
normalized_scores = (adjusted_scores / adjusted_scores.max()) * 9 # Scale to 9
|
42 |
-
|
43 |
-
# Apply
|
44 |
-
additional_reduction =
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
# Round the scores
|
49 |
rounded_scores = np.round(normalized_scores * 2) / 2
|
50 |
-
|
51 |
# Display the predictions
|
52 |
labels = ["Task Achievement", "Coherence and Cohesion", "Vocabulary", "Grammar", "Overall"]
|
53 |
for label, score in zip(labels, rounded_scores):
|
54 |
st.write(f"{label}: {score:.1f}")
|
55 |
else:
|
56 |
-
st.write("Please enter some text to get scores.")
|
|
|
26 |
|
27 |
# Extract the predictions
|
28 |
predictions = outputs.logits.squeeze()
|
29 |
+
|
30 |
# Convert to numpy array if necessary
|
31 |
predicted_scores = predictions.numpy()
|
32 |
+
|
33 |
+
# Apply a significant uniform reduction (e.g., reduce by 80%)
|
34 |
+
reduction_factor = 0.6 # Reduce scores by 80%
|
35 |
adjusted_scores = predicted_scores * reduction_factor
|
36 |
+
|
37 |
# Ensure scores do not go below zero
|
38 |
adjusted_scores = np.maximum(adjusted_scores, 0)
|
39 |
+
|
40 |
# Normalize the scores to ensure they fall within the 0-9 range
|
41 |
normalized_scores = (adjusted_scores / adjusted_scores.max()) * 9 # Scale to 9
|
42 |
+
|
43 |
+
# Apply additional reductions to all scores
|
44 |
+
additional_reduction = 1.5 # Further reduce all scores
|
45 |
+
normalized_scores = np.maximum(normalized_scores - additional_reduction, 0)
|
46 |
+
|
|
|
47 |
# Round the scores
|
48 |
rounded_scores = np.round(normalized_scores * 2) / 2
|
49 |
+
|
50 |
# Display the predictions
|
51 |
labels = ["Task Achievement", "Coherence and Cohesion", "Vocabulary", "Grammar", "Overall"]
|
52 |
for label, score in zip(labels, rounded_scores):
|
53 |
st.write(f"{label}: {score:.1f}")
|
54 |
else:
|
55 |
+
st.write("Please enter some text to get scores.")
|