Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -6,7 +6,7 @@ from transformers import AutoModelForSequenceClassification, AutoTokenizer, pipe
|
|
6 |
from transformers import AutoModelForQuestionAnswering
|
7 |
|
8 |
# Load fine-tuned models and tokenizers for both functions
|
9 |
-
model_name_classification = "TAgroup5/news-classification-model"
|
10 |
model = AutoModelForSequenceClassification.from_pretrained(model_name_classification)
|
11 |
tokenizer = AutoTokenizer.from_pretrained(model_name_classification)
|
12 |
|
@@ -15,6 +15,14 @@ model_qa = AutoModelForQuestionAnswering.from_pretrained(model_name_qa)
|
|
15 |
tokenizer_qa = AutoTokenizer.from_pretrained(model_name_qa)
|
16 |
|
17 |
# Initialize pipelines
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
text_classification_pipeline = pipeline("text-classification", model=model, tokenizer=tokenizer)
|
19 |
qa_pipeline = pipeline("question-answering", model=model)
|
20 |
|
|
|
6 |
from transformers import AutoModelForQuestionAnswering
|
7 |
|
8 |
# Load fine-tuned models and tokenizers for both functions
|
9 |
+
model_name_classification = "TAgroup5/news-classification-model"
|
10 |
model = AutoModelForSequenceClassification.from_pretrained(model_name_classification)
|
11 |
tokenizer = AutoTokenizer.from_pretrained(model_name_classification)
|
12 |
|
|
|
15 |
tokenizer_qa = AutoTokenizer.from_pretrained(model_name_qa)
|
16 |
|
17 |
# Initialize pipelines
|
18 |
+
from transformers import pipeline, AutoModelForQuestionAnswering, AutoTokenizer
|
19 |
+
|
20 |
+
model_name = "distilbert-base-cased-distilled-squad" # Example model
|
21 |
+
model = AutoModelForQuestionAnswering.from_pretrained(model_name)
|
22 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
23 |
+
|
24 |
+
qa_pipeline = pipeline("question-answering", model=model, tokenizer=tokenizer)
|
25 |
+
|
26 |
text_classification_pipeline = pipeline("text-classification", model=model, tokenizer=tokenizer)
|
27 |
qa_pipeline = pipeline("question-answering", model=model)
|
28 |
|