Spaces:
Running
Running
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
def predict(meals, hours_left, distance):
|
| 4 |
+
score = 0
|
| 5 |
+
|
| 6 |
+
if hours_left < 4:
|
| 7 |
+
score += 3
|
| 8 |
+
elif hours_left < 8:
|
| 9 |
+
score += 2
|
| 10 |
+
else:
|
| 11 |
+
score += 1
|
| 12 |
+
|
| 13 |
+
if meals > 100:
|
| 14 |
+
score += 3
|
| 15 |
+
elif meals > 50:
|
| 16 |
+
score += 2
|
| 17 |
+
else:
|
| 18 |
+
score += 1
|
| 19 |
+
|
| 20 |
+
if distance < 5:
|
| 21 |
+
score += 3
|
| 22 |
+
elif distance < 15:
|
| 23 |
+
score += 2
|
| 24 |
+
else:
|
| 25 |
+
score += 1
|
| 26 |
+
|
| 27 |
+
if score >= 7:
|
| 28 |
+
return "HIGH PRIORITY - Distribute immediately"
|
| 29 |
+
elif score >= 5:
|
| 30 |
+
return "MEDIUM PRIORITY - Schedule soon"
|
| 31 |
+
else:
|
| 32 |
+
return "LOW PRIORITY - Can wait"
|
| 33 |
+
|
| 34 |
+
iface = gr.Interface(
|
| 35 |
+
fn=predict,
|
| 36 |
+
inputs=["number", "number", "number"],
|
| 37 |
+
outputs="text"
|
| 38 |
+
)
|
| 39 |
+
|
| 40 |
+
iface.launch()
|