Spaces:
Sleeping
Sleeping
Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
| 1 |
-
|
| 2 |
import os # For filesystem operations
|
| 3 |
import shutil # For directory cleanup
|
| 4 |
import zipfile # For extracting model archives
|
|
@@ -137,8 +136,7 @@ def do_predict(phone_hours, computer_hours, device_count, sleep_quality_label, s
|
|
| 137 |
|
| 138 |
md = f"**Prediction:** {pred_label}"
|
| 139 |
if proba_dict:
|
| 140 |
-
md += f"
|
| 141 |
-
**Confidence:** {round(proba_dict.get(pred_label, 0.0) * 100, 2)}%"
|
| 142 |
print("Markdown output (md):")
|
| 143 |
print(md)
|
| 144 |
|
|
@@ -163,9 +161,9 @@ EXAMPLES = [
|
|
| 163 |
with gradio.Blocks() as demo:
|
| 164 |
# Provide an introduction
|
| 165 |
gradio.Markdown("# Device Use Before Sleep Predictor")
|
| 166 |
-
gradio.Markdown("
|
| 167 |
-
This app predicts whether a student uses their device before sleep based on their device usage and sleeping habits.
|
| 168 |
-
")
|
| 169 |
|
| 170 |
with gradio.Row():
|
| 171 |
phone_hours = gradio.Slider(0, 10, step=0.1, value=2.0, label=FEATURE_COLS[0])
|
|
|
|
|
|
|
| 1 |
import os # For filesystem operations
|
| 2 |
import shutil # For directory cleanup
|
| 3 |
import zipfile # For extracting model archives
|
|
|
|
| 136 |
|
| 137 |
md = f"**Prediction:** {pred_label}"
|
| 138 |
if proba_dict:
|
| 139 |
+
md += f" \n**Confidence:** {round(proba_dict.get(pred_label, 0.0) * 100, 2)}%"
|
|
|
|
| 140 |
print("Markdown output (md):")
|
| 141 |
print(md)
|
| 142 |
|
|
|
|
| 161 |
with gradio.Blocks() as demo:
|
| 162 |
# Provide an introduction
|
| 163 |
gradio.Markdown("# Device Use Before Sleep Predictor")
|
| 164 |
+
gradio.Markdown("""
|
| 165 |
+
This app predicts whether a student uses their device before sleep based on their device usage and sleeping habits.
|
| 166 |
+
""")
|
| 167 |
|
| 168 |
with gradio.Row():
|
| 169 |
phone_hours = gradio.Slider(0, 10, step=0.1, value=2.0, label=FEATURE_COLS[0])
|