File size: 798 Bytes
b0f3990
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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()