Skip to content

Commit

Permalink
Update dashboard_CLOUD.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Isdinval authored Jun 6, 2024
1 parent aa345f8 commit 56b03f4
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions dashboard_CLOUD.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,42 @@ def main():
st.markdown("---")
st.write(f"The probability of default on the loan is estimated to be {probability_class1 * 100:.2f}% (Threshold: {optimal_threshold * 100:.2f}%).")



# Define gauge parameters (feel free to customize)
gauge_min = 0.0 # Minimum value for the score
gauge_max = 1.0 # Maximum value for the score
gauge_size = 200 # Size of the gauge in pixels

# Define gauge value and color based on score
gauge_value = probability_class1
if prediction_label == "Accepted":
gauge_color = "green" # Green for accepted loans
else:
gauge_color = "red" # Red for declined loans

# Calculate position for text elements (adjust as needed)
text_offset_y = gauge_size * 0.2 # Vertical offset for text
text_size = gauge_size * 0.15 # Font size for text

# Create colored gauge HTML with text elements
gauge_html = f"""
<div style="text-align: center; margin: 10px auto;">
<div style="width: {gauge_size}px; height: {gauge_size}px; border-radius: 50%; border: 5px solid #ddd;">
<div style="width: {gauge_size * gauge_value}px; height: {gauge_size}px; background-color: {gauge_color}; border-radius: 50%; transition: all 1s ease-in-out;"></div>
</div>
<p style="font-weight: bold; position: relative; top: {text_offset_y}px; font-size: {text_size}px;">{probability_class1 * 100:.2f}%</p>
<p style="position: relative; top: -{text_offset_y}px; font-size: {text_size}px;">Threshold: {optimal_threshold * 100:.2f}%</p>
</div>
"""








if prediction_label == "Accepted":
st.markdown("<p style='text-align: center; font-size: 40px; color: green;'>The loan application is approved.</p>", unsafe_allow_html=True)
else:
Expand Down

0 comments on commit 56b03f4

Please sign in to comment.