Update app.py
Browse files
app.py
CHANGED
@@ -8,15 +8,12 @@ from haystack import Document
|
|
8 |
from haystack.components.readers import ExtractiveReader
|
9 |
import wikipediaapi
|
10 |
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
translator = pipeline("translation", model="facebook/nllb-200-distilled-600M", torch_dtype=torch.bfloat16)
|
18 |
-
|
19 |
-
return model, feature_extractor, tokenizer_qa, model_qa, summarizer, translator
|
20 |
|
21 |
def translate_question(question, translator):
|
22 |
text_translated = translator(question,
|
@@ -42,8 +39,6 @@ def process_input(img, text):
|
|
42 |
title="Banana Leaf Disease Classifier"
|
43 |
labels = ['banana_healthy_leaf', 'black_sigatoka', 'yellow_sigatoka', 'panama_disease', 'moko_disease', 'insect_pest', 'bract_mosaic_virus']
|
44 |
|
45 |
-
model, feature_extractor, tokenizer_qa, model_qa, summarizer, translator = init_models()
|
46 |
-
|
47 |
|
48 |
translate_eng_question = translate_question(text, translator)
|
49 |
|
|
|
8 |
from haystack.components.readers import ExtractiveReader
|
9 |
import wikipediaapi
|
10 |
|
11 |
+
model = ViTForImageClassification.from_pretrained("Dmitry43243242/banana-disease-leaf-model")
|
12 |
+
feature_extractor = ViTFeatureExtractor.from_pretrained("Dmitry43243242/banana-disease-leaf-model")
|
13 |
+
tokenizer_qa = AutoTokenizer.from_pretrained("deepset/roberta-base-squad2")
|
14 |
+
model_qa = AutoModelForQuestionAnswering.from_pretrained("deepset/roberta-base-squad2")
|
15 |
+
summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
|
16 |
+
translator = pipeline("translation", model="facebook/nllb-200-distilled-600M", torch_dtype=torch.bfloat16)
|
|
|
|
|
|
|
17 |
|
18 |
def translate_question(question, translator):
|
19 |
text_translated = translator(question,
|
|
|
39 |
title="Banana Leaf Disease Classifier"
|
40 |
labels = ['banana_healthy_leaf', 'black_sigatoka', 'yellow_sigatoka', 'panama_disease', 'moko_disease', 'insect_pest', 'bract_mosaic_virus']
|
41 |
|
|
|
|
|
42 |
|
43 |
translate_eng_question = translate_question(text, translator)
|
44 |
|