dejanseo commited on
Commit
e0f1c61
·
verified ·
1 Parent(s): d150300

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -38,11 +38,15 @@ def load_model():
38
  tokenizer, model = load_model()
39
 
40
  def generate_json_output(text):
 
 
 
 
41
  prompt = f"""You are a web page text scanner. Your task is to carefully review text from a web page.
42
 
43
  The following text is extracted from a web page.
44
 
45
- "{text}"
46
 
47
  Answer the following questions:
48
  1) What brand does the page represent?
 
38
  tokenizer, model = load_model()
39
 
40
  def generate_json_output(text):
41
+ # Truncate text to a reasonable length to avoid index out of bounds errors
42
+ max_chars = 3000 # Adjust this value based on experimentation
43
+ truncated_text = text[:max_chars]
44
+
45
  prompt = f"""You are a web page text scanner. Your task is to carefully review text from a web page.
46
 
47
  The following text is extracted from a web page.
48
 
49
+ "{truncated_text}"
50
 
51
  Answer the following questions:
52
  1) What brand does the page represent?