Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import fasttext
|
| 3 |
+
from huggingface_hub import hf_hub_download
|
| 4 |
+
|
| 5 |
+
model_path = hf_hub_download(repo_id="facebook/fasttext-language-identification", filename="model.bin")
|
| 6 |
+
model = fasttext.load_model(model_path)
|
| 7 |
+
|
| 8 |
+
def classify(input):
|
| 9 |
+
result = model.predict(input, k=5)
|
| 10 |
+
return result
|
| 11 |
+
|
| 12 |
+
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
| 13 |
+
iface.launch()
|