Maddy90 commited on
Commit
4f6b579
·
verified ·
1 Parent(s): bbc6971

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -8
app.py CHANGED
@@ -1,14 +1,9 @@
1
  import gradio as gr
2
  from transformers import pipeline
3
 
4
- # Load the pre-trained BART model and tokenizer
5
- bart_model_path = "bart_QA"
6
- if os.path.exists(bart_model_path):
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() == "":