wahab5763 commited on
Commit
8bfec55
·
verified ·
1 Parent(s): ddd6099

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -10,11 +10,13 @@ def load_ocr_model():
10
  # Load text-generation model
11
  @st.cache_resource
12
  def load_text_model():
13
- return pipeline("text-generation", model="EleutherAI/gpt-neo-2.7B")
14
 
15
  # Function to process text with a language model
16
  def process_with_llm(prompt):
17
  try:
 
 
18
  llm_model = load_text_model()
19
  response = llm_model(prompt, max_length=500, do_sample=True, temperature=0.7)
20
  if response and len(response) > 0:
 
10
  # Load text-generation model
11
  @st.cache_resource
12
  def load_text_model():
13
+ return pipeline("text-generation", model="EleutherAI/gpt-neo-1.3B") # Use a smaller model for better compatibility
14
 
15
  # Function to process text with a language model
16
  def process_with_llm(prompt):
17
  try:
18
+ if len(prompt) > 512:
19
+ prompt = prompt[:512] + "..." # Truncate long prompts
20
  llm_model = load_text_model()
21
  response = llm_model(prompt, max_length=500, do_sample=True, temperature=0.7)
22
  if response and len(response) > 0: