Update app.py
Browse files
app.py
CHANGED
@@ -1,31 +1,5 @@
|
|
1 |
-
|
2 |
-
import
|
3 |
-
import numpy as np
|
4 |
-
import gradio as gr
|
5 |
|
6 |
-
|
7 |
-
|
8 |
-
model = fasttext.load_model(model_path)
|
9 |
-
|
10 |
-
# ์์ ๋ predict ํจ์
|
11 |
-
def patched_predict(model, text):
|
12 |
-
labels, probs = model.predict(text)
|
13 |
-
return labels, np.asarray(probs)
|
14 |
-
|
15 |
-
# ์์ธก ํจ์
|
16 |
-
def predict_language(text):
|
17 |
-
predictions = patched_predict(model, text)
|
18 |
-
return {
|
19 |
-
"Predicted language": predictions[0][0],
|
20 |
-
"Confidence score": predictions[1][0]
|
21 |
-
}
|
22 |
-
|
23 |
-
# Gradio ์ธํฐํ์ด์ค
|
24 |
-
interface = gr.Interface(
|
25 |
-
fn=predict_language,
|
26 |
-
inputs=gr.Textbox(label="Input Text"),
|
27 |
-
outputs="json",
|
28 |
-
title="Language Predictor"
|
29 |
-
)
|
30 |
-
|
31 |
-
interface.launch()
|
|
|
1 |
+
# Load model directly
|
2 |
+
from transformers import AutoTokenizer, AutoModelForQuestionAnswering
|
|
|
|
|
3 |
|
4 |
+
tokenizer = AutoTokenizer.from_pretrained("ainize/klue-bert-base-mrc")
|
5 |
+
model = AutoModelForQuestionAnswering.from_pretrained("ainize/klue-bert-base-mrc")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|