stanslausmwongela commited on
Commit
e4eab97
1 Parent(s): 75033a0

Added the ML App Inference

Browse files
Files changed (1) hide show
  1. app/app.py +23 -0
app/app.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import pandas as pd
3
+ import json
4
+ from tqdm import tqdm
5
+ from predict import Preprocess, Facility_Model, obj_Facility_Model, processor
6
+
7
+ def predict_facility(data):
8
+ pred_data = processor.process_tokenizer(data)
9
+ predictions = obj_Facility_Model.inference(pred_data)
10
+ return json.loads(predictions)
11
+
12
+
13
+ iface = gr.Interface(
14
+ fn=predict_facility,
15
+ inputs="text",
16
+ outputs="json",
17
+ title=" Single Facility Prediction",
18
+ description="Predict the facility based on input data.",
19
+ #examples=[["kilifi"], ["mombasa"], ["nairobi"]],
20
+ )
21
+
22
+ if __name__ == "__main__":
23
+ iface.launch()