sabssag commited on
Commit
519d900
·
verified ·
1 Parent(s): 1ae8aab

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -21,13 +21,16 @@ with zipfile.ZipFile(zip_model_path, 'r') as zip_ref:
21
  # After unzipping, the model should be in a specific directory, check the directory structure
22
  model_path = os.path.join(model_dir, 'Bart_model')
23
 
 
 
 
24
  # Verify that the directory exists and contains the necessary files
25
  if not os.path.exists(model_path):
26
  st.error(f"Model directory {model_path} does not exist or is incorrect.")
27
  else:
28
  # Load the tokenizer and model
29
- tokenizer = BartTokenizer.from_pretrained(model_name)
30
- model = BartForConditionalGeneration.from_pretrained(model_name)
31
 
32
  # Create a summarization pipeline
33
  summarizer = pipeline("summarization", model=model, tokenizer=tokenizer)
@@ -50,4 +53,4 @@ else:
50
  st.subheader("Generated Summary")
51
  st.write(generated_summary)
52
  else:
53
- st.warning("Please enter some text to generate a summary.")
 
21
  # After unzipping, the model should be in a specific directory, check the directory structure
22
  model_path = os.path.join(model_dir, 'Bart_model')
23
 
24
+ # Print out the model_path for debugging
25
+ print("Model Path:", model_path)
26
+
27
  # Verify that the directory exists and contains the necessary files
28
  if not os.path.exists(model_path):
29
  st.error(f"Model directory {model_path} does not exist or is incorrect.")
30
  else:
31
  # Load the tokenizer and model
32
+ tokenizer = BartTokenizer.from_pretrained('facebook/bart-large-cnn')
33
+ model = BartForConditionalGeneration.from_pretrained(model_path)
34
 
35
  # Create a summarization pipeline
36
  summarizer = pipeline("summarization", model=model, tokenizer=tokenizer)
 
53
  st.subheader("Generated Summary")
54
  st.write(generated_summary)
55
  else:
56
+ st.warning("Please enter some text to generate a summary.")