Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -48,14 +48,15 @@ def predict(last_name,n_predictions=3):
|
|
| 48 |
for i in range(n_predictions):
|
| 49 |
value = topv[0]
|
| 50 |
category_index = topi[0][i].item()
|
| 51 |
-
top_3_countries += f'{all_categories[category_index]}: {round(value[i].item()*100,2)}%'
|
| 52 |
top_3_countries += '\n'
|
| 53 |
return top_3_countries
|
| 54 |
|
| 55 |
demo = gr.Interface(predict,
|
| 56 |
inputs = "text",
|
| 57 |
-
outputs = "text",
|
| 58 |
-
|
|
|
|
| 59 |
)
|
| 60 |
|
| 61 |
demo.launch(inline=False)
|
|
|
|
| 48 |
for i in range(n_predictions):
|
| 49 |
value = topv[0]
|
| 50 |
category_index = topi[0][i].item()
|
| 51 |
+
top_3_countries += f'{all_categories[category_index]}: {round(value[i].item()*100,2)}% confident'
|
| 52 |
top_3_countries += '\n'
|
| 53 |
return top_3_countries
|
| 54 |
|
| 55 |
demo = gr.Interface(predict,
|
| 56 |
inputs = "text",
|
| 57 |
+
outputs = "text",
|
| 58 |
+
title = "Classify Name :)"
|
| 59 |
+
description="Classifies name into one of 18 language of origin. Returns top 3 languages of origin"
|
| 60 |
)
|
| 61 |
|
| 62 |
demo.launch(inline=False)
|