Update app.py
Browse files
app.py
CHANGED
|
@@ -1,18 +1,18 @@
|
|
| 1 |
-
|
| 2 |
|
| 3 |
import gradio as gr
|
| 4 |
from transformers import pipeline, AutoModelForQuestionAnswering, AutoTokenizer, AutoModelForTokenClassification
|
| 5 |
|
| 6 |
# Load your custom model and tokenizer
|
| 7 |
qa_model_name = "erdometo/xlm-roberta-base-finetuned-TQuad2"
|
| 8 |
-
token_classification_model_name = "
|
| 9 |
|
| 10 |
qa_model = AutoModelForQuestionAnswering.from_pretrained(qa_model_name)
|
| 11 |
qa_tokenizer = AutoTokenizer.from_pretrained(qa_model_name)
|
| 12 |
|
| 13 |
token_classification_model = AutoModelForTokenClassification.from_pretrained(token_classification_model_name)
|
| 14 |
token_classification_tokenizer = AutoTokenizer.from_pretrained(token_classification_model_name)
|
| 15 |
-
|
|
|
|
| 16 |
def predict(pipeline_type, question, context):
|
| 17 |
if pipeline_type == "question-answering":
|
| 18 |
qa_pipeline = pipeline("question-answering", model=qa_model, tokenizer=qa_tokenizer)
|
|
|
|
|
|
|
| 1 |
|
| 2 |
import gradio as gr
|
| 3 |
from transformers import pipeline, AutoModelForQuestionAnswering, AutoTokenizer, AutoModelForTokenClassification
|
| 4 |
|
| 5 |
# Load your custom model and tokenizer
|
| 6 |
qa_model_name = "erdometo/xlm-roberta-base-finetuned-TQuad2"
|
| 7 |
+
token_classification_model_name = "akdeniz27/convbert-base-turkish-cased-ner"
|
| 8 |
|
| 9 |
qa_model = AutoModelForQuestionAnswering.from_pretrained(qa_model_name)
|
| 10 |
qa_tokenizer = AutoTokenizer.from_pretrained(qa_model_name)
|
| 11 |
|
| 12 |
token_classification_model = AutoModelForTokenClassification.from_pretrained(token_classification_model_name)
|
| 13 |
token_classification_tokenizer = AutoTokenizer.from_pretrained(token_classification_model_name)
|
| 14 |
+
|
| 15 |
+
|
| 16 |
def predict(pipeline_type, question, context):
|
| 17 |
if pipeline_type == "question-answering":
|
| 18 |
qa_pipeline = pipeline("question-answering", model=qa_model, tokenizer=qa_tokenizer)
|