Update app.py
Browse files
app.py
CHANGED
|
@@ -1,14 +1,9 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import pipeline
|
| 3 |
|
| 4 |
-
# Load the
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
bart_model = AutoModelForSeq2SeqLM.from_pretrained(bart_model_path)
|
| 8 |
-
print(f"Loaded BART model from {bart_model_path}")
|
| 9 |
-
else:
|
| 10 |
-
print(f"BART model not found in {bart_model_path}. Please ensure the model is uploaded.")
|
| 11 |
-
exit(1)
|
| 12 |
|
| 13 |
def answer_question(question, context):
|
| 14 |
if question.strip() == "" or context.strip() == "":
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import pipeline
|
| 3 |
|
| 4 |
+
# Load the trained model
|
| 5 |
+
model_path = "bart_QA"
|
| 6 |
+
qa_pipeline = pipeline("question-answering", model=model_path, tokenizer=model_path)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
def answer_question(question, context):
|
| 9 |
if question.strip() == "" or context.strip() == "":
|