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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -6
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", page_icon="🔑")
8
 
9
  # Define the model
10
- model_name = "t5-small"
11
 
12
  # Cache the model and tokenizer to avoid reloading
13
  @st.cache_resource
@@ -24,8 +24,12 @@ def generate_keypoint(review, max_new_tokens=64):
24
 
25
  start_time = time.time()
26
 
27
- # T5-specific prompt
28
- prompt = f"summarize: {review}"
 
 
 
 
29
 
30
  # Inference
31
  inputs = tokenizer(prompt, return_tensors="pt", truncation=True, padding=True).to(device)
@@ -41,8 +45,8 @@ def generate_keypoint(review, max_new_tokens=64):
41
  return keypoint, elapsed
42
 
43
  # Streamlit UI
44
- st.title("🔑 Review Keypoint Extractor")
45
- st.write("Enter a product review below to extract its key points using the T5-Small 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.")
 
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
 
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
  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.")