TLH01 commited on
Commit
4111288
·
verified ·
1 Parent(s): 06c169e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -10
app.py CHANGED
@@ -4,10 +4,10 @@ import time
4
  from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
5
 
6
  # Streamlit page configuration
7
- st.set_page_config(page_title="Review Keypoint Extractor (MeetingSummary)", page_icon="🔑")
8
 
9
  # Define the model
10
- model_name = "knkarthick/MEETING_SUMMARY"
11
 
12
  # Cache the model and tokenizer to avoid reloading
13
  @st.cache_resource
@@ -24,12 +24,8 @@ def generate_keypoint(review, max_new_tokens=64):
24
 
25
  start_time = time.time()
26
 
27
- # Prompt specific for MEETING_SUMMARY
28
- prompt = (
29
- "Extract the key points (both strengths and weaknesses) from the following review.\n"
30
- 'If there are no key points, say "No key point".\n\n'
31
- f"{review}"
32
- )
33
 
34
  # Inference
35
  inputs = tokenizer(prompt, return_tensors="pt", truncation=True, padding=True).to(device)
@@ -45,8 +41,8 @@ def generate_keypoint(review, max_new_tokens=64):
45
  return keypoint, elapsed
46
 
47
  # Streamlit UI
48
- st.title("🔑 Review Keypoint Extractor (MeetingSummary)")
49
- st.write("Enter a product review below to extract its key points using the knkarthick/MEETING_SUMMARY model.")
50
 
51
  # Input field for review
52
  review = st.text_area("Product Review", placeholder="e.g., The Jackery power station is lightweight and charges quickly, but the battery life could be longer.")
 
4
  from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
5
 
6
  # Streamlit page configuration
7
+ st.set_page_config(page_title="Review Keypoint Extractor (DistilBART-CNN-12-6)", page_icon="🔑")
8
 
9
  # Define the model
10
+ model_name = "sshleifer/distilbart-cnn-12-6"
11
 
12
  # Cache the model and tokenizer to avoid reloading
13
  @st.cache_resource
 
24
 
25
  start_time = time.time()
26
 
27
+ # BART-specific prompt (no additional prompt engineering)
28
+ prompt = review
 
 
 
 
29
 
30
  # Inference
31
  inputs = tokenizer(prompt, return_tensors="pt", truncation=True, padding=True).to(device)
 
41
  return keypoint, elapsed
42
 
43
  # Streamlit UI
44
+ st.title("🔑 Review Keypoint Extractor (DistilBART-CNN-12-6)")
45
+ st.write("Enter a product review below to extract its key points using the sshleifer/distilbart-cnn-12-6 model.")
46
 
47
  # Input field for review
48
  review = st.text_area("Product Review", placeholder="e.g., The Jackery power station is lightweight and charges quickly, but the battery life could be longer.")