Spaces:
Runtime error
Runtime error
import gradio as gr | |
import pandas as pd | |
import json | |
from tqdm import tqdm | |
from predict import Preprocess, Facility_Model, obj_Facility_Model, processor | |
def predict_facility(data): | |
pred_data = processor.process_tokenizer(data) | |
predictions = obj_Facility_Model.inference(pred_data) | |
return json.loads(predictions) | |
iface = gr.Interface( | |
fn=predict_facility, | |
inputs="text", | |
outputs="json", | |
title=" Single Facility Prediction", | |
description="Predict the facility based on input data.", | |
#examples=[["kilifi"], ["mombasa"], ["nairobi"]], | |
) | |
if __name__ == "__main__": | |
iface.launch() |