Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -14,8 +14,7 @@ DEFAULT_SYSTEM_MESSAGE = "You are an expert in criminogenic risk prediction. Pro
|
|
| 14 |
DEFAULT_ALIAS = "anon" # Default alias
|
| 15 |
|
| 16 |
def calculate_criminogenic_risk(individual_score, social_family_score, environmental_score, alias=DEFAULT_ALIAS, max_tokens=DEFAULT_MAX_TOKENS, temperature=DEFAULT_TEMPERATURE, top_p=DEFAULT_TOP_P, system_message=DEFAULT_SYSTEM_MESSAGE):
|
| 17 |
-
# Calculate the criminogenic risk score
|
| 18 |
-
# Since the inputs are on a scale of 1 to 5, we'll scale to a percentage (0 to 100)
|
| 19 |
risk_score = ((individual_score + social_family_score + environmental_score) / 15) * 100
|
| 20 |
|
| 21 |
# Construct the input message for the model with context
|
|
@@ -102,9 +101,9 @@ h2, h3, h4 {
|
|
| 102 |
|
| 103 |
# Create the Gradio interface with custom CSS
|
| 104 |
inputs = [
|
| 105 |
-
gr.Slider(minimum=1, maximum=5, step=1, label="
|
| 106 |
-
gr.Slider(minimum=1, maximum=5, step=1, label="
|
| 107 |
-
gr.Slider(minimum=1, maximum=5, step=1, label="
|
| 108 |
gr.Textbox(placeholder="Enter a single-word alias (e.g., anon).", label="Your Alias", lines=1)
|
| 109 |
]
|
| 110 |
|
|
@@ -118,6 +117,6 @@ gr.Interface(
|
|
| 118 |
inputs=inputs,
|
| 119 |
outputs=outputs,
|
| 120 |
title="JAMBAZI: Criminogenic Risk Factors Predictor",
|
| 121 |
-
description="
|
| 122 |
css=custom_css # Apply custom CSS
|
| 123 |
).launch()
|
|
|
|
| 14 |
DEFAULT_ALIAS = "anon" # Default alias
|
| 15 |
|
| 16 |
def calculate_criminogenic_risk(individual_score, social_family_score, environmental_score, alias=DEFAULT_ALIAS, max_tokens=DEFAULT_MAX_TOKENS, temperature=DEFAULT_TEMPERATURE, top_p=DEFAULT_TOP_P, system_message=DEFAULT_SYSTEM_MESSAGE):
|
| 17 |
+
# Calculate the criminogenic risk score as a percentage (0 to 100)
|
|
|
|
| 18 |
risk_score = ((individual_score + social_family_score + environmental_score) / 15) * 100
|
| 19 |
|
| 20 |
# Construct the input message for the model with context
|
|
|
|
| 101 |
|
| 102 |
# Create the Gradio interface with custom CSS
|
| 103 |
inputs = [
|
| 104 |
+
gr.Slider(minimum=1, maximum=5, step=1, label="How much do personal issues (like mental health or behavior) affect your risk? (1 = Not at all, 5 = Very much)"),
|
| 105 |
+
gr.Slider(minimum=1, maximum=5, step=1, label="How much do your family or social relationships affect your risk? (1 = Not at all, 5 = Very much)"),
|
| 106 |
+
gr.Slider(minimum=1, maximum=5, step=1, label="How much does your environment (like your neighborhood or economic situation) affect your risk? (1 = Not at all, 5 = Very much)"),
|
| 107 |
gr.Textbox(placeholder="Enter a single-word alias (e.g., anon).", label="Your Alias", lines=1)
|
| 108 |
]
|
| 109 |
|
|
|
|
| 117 |
inputs=inputs,
|
| 118 |
outputs=outputs,
|
| 119 |
title="JAMBAZI: Criminogenic Risk Factors Predictor",
|
| 120 |
+
description="Evaluate how individual, social, and environmental factors influence your risk by rating each on a scale from 1 (Not at all) to 5 (Very much). Receive a risk score and personalized recommendations based on your inputs.",
|
| 121 |
css=custom_css # Apply custom CSS
|
| 122 |
).launch()
|