Spaces:
Sleeping
Sleeping
Upload 3 files
Browse files- app (1).py +32 -0
- canteen_surplus_data.pkl +3 -0
- requirements (1).txt +8 -0
app (1).py
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import pickle
|
| 3 |
+
|
| 4 |
+
def load_and_display_data():
|
| 5 |
+
"""Loads the pickled data and formats it for display."""
|
| 6 |
+
try:
|
| 7 |
+
with open('canteen_surplus_data.pkl', 'rb') as f:
|
| 8 |
+
data = pickle.load(f)
|
| 9 |
+
# Format the dictionary for better display in Gradio
|
| 10 |
+
formatted_output = ""
|
| 11 |
+
for canteen_id, info in data.items():
|
| 12 |
+
formatted_output += f"Canteen ID: {canteen_id}\n"
|
| 13 |
+
formatted_output += f" Canteen Name: {info['canteen_name']}\n"
|
| 14 |
+
formatted_output += f" Predicted Surplus: {info['predicted_surplus']}\n"
|
| 15 |
+
formatted_output += f" NGO Requirement: {info['ngo_requirement']}\n"
|
| 16 |
+
formatted_output += "-" * 20 + "\n"
|
| 17 |
+
return formatted_output
|
| 18 |
+
except FileNotFoundError:
|
| 19 |
+
return "Error: canteen_surplus_data.pkl not found."
|
| 20 |
+
except Exception as e:
|
| 21 |
+
return f"An error occurred: {e}"
|
| 22 |
+
|
| 23 |
+
# Create a Gradio interface to display the data
|
| 24 |
+
iface = gr.Interface(
|
| 25 |
+
fn=load_and_display_data,
|
| 26 |
+
inputs=None, # No input needed to display the data
|
| 27 |
+
outputs="text",
|
| 28 |
+
title="Canteen Surplus and NGO Requirements",
|
| 29 |
+
description="Displays the predicted surplus units and NGO requirements for each canteen."
|
| 30 |
+
)
|
| 31 |
+
|
| 32 |
+
iface.launch()
|
canteen_surplus_data.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f8f08a8b87d17a802bbf3d7464c89259a6f404a6564737767e6c44eeafe8177d
|
| 3 |
+
size 518
|
requirements (1).txt
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
pandas
|
| 2 |
+
scikit-learn
|
| 3 |
+
catboost
|
| 4 |
+
xgboost
|
| 5 |
+
matplotlib
|
| 6 |
+
seaborn
|
| 7 |
+
huggingface_hub
|
| 8 |
+
joblib
|