Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import pipeline
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
pipe = pipeline("text-classification", model="topsinfosolutions/indian-state-by-name")
|
5 |
+
|
6 |
+
def predict(text):
|
7 |
+
result = pipe(text)
|
8 |
+
return result[0]["label"]
|
9 |
+
|
10 |
+
|
11 |
+
iface = gr.Interface(
|
12 |
+
fn=predict,
|
13 |
+
inputs=gr.Textbox(label="Enter an Indian name", placeholder="Enter a name here..."),
|
14 |
+
outputs=gr.Textbox(label="Predicted Indian State"),
|
15 |
+
title="Indian State Prediction - (Just Trained on Few States and Only 81 Example data, expect upto 70% accurate.)",
|
16 |
+
description="Predicts the Indian state based on a given name.",
|
17 |
+
examples=[
|
18 |
+
["Anuradha Singh Krishnan"],
|
19 |
+
["Ramesh Kumar"],
|
20 |
+
["Priya Sharma"],
|
21 |
+
["Vivak Gajjar"],
|
22 |
+
["Aishwarya Rai"],
|
23 |
+
["Mamata Banerjee"]
|
24 |
+
]
|
25 |
+
)
|
26 |
+
|
27 |
+
|
28 |
+
iface.launch()
|