YiyangLewisLu
commited on
Commit
•
d1c8038
1
Parent(s):
807cf21
Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,17 @@
|
|
1 |
import gradio as gr
|
|
|
|
|
|
|
2 |
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
import fasttext
|
4 |
+
from huggingface_hub import hf_hub_download
|
5 |
|
6 |
+
model_path = hf_hub_download(repo_id="facebook/fasttext-language-identification", filename="model.bin")
|
7 |
+
model = fasttext.load_model(model_path)
|
8 |
+
|
9 |
+
def launch(input):
|
10 |
+
out = model.predict(input)
|
11 |
+
return out[0][0]
|
12 |
+
|
13 |
+
iface = gr.Interface(launch,
|
14 |
+
inputs=gr.Text(type='text'),
|
15 |
+
outputs="text")
|
16 |
+
|
17 |
+
iface.launch()
|