from transformers import pipeline import gradio as gr pipe = pipeline("text-classification", model="topsinfosolutions/indian-state-by-name") def predict(text): result = pipe(text) return result[0]["label"] iface = gr.Interface( fn=predict, inputs=gr.Textbox(label="Enter an Indian name", placeholder="Enter a name here..."), outputs=gr.Textbox(label="Predicted Indian State"), title="Indian State Prediction - (Just Trained on Few States and Only 81 Example data, expect upto 70% accurate.)", description="Predicts the Indian state based on a given name.", examples=[ ["Anuradha Singh Krishnan"], ["Ramesh Kumar"], ["Priya Sharma"], ["Vivak Gajjar"], ["Aishwarya Rai"], ["Mamata Banerjee"] ] ) iface.launch()