s2337a commited on
Commit
994f279
ยท
verified ยท
1 Parent(s): 64d929d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -30
app.py CHANGED
@@ -1,31 +1,5 @@
1
- from huggingface_hub import hf_hub_download
2
- import fasttext
3
- import numpy as np
4
- import gradio as gr
5
 
6
- # ๋ชจ๋ธ ๋‹ค์šด๋กœ๋“œ
7
- model_path = hf_hub_download(repo_id="cis-lmu/glotlid", filename="model.bin")
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")