smishr-18 commited on
Commit
8a6b415
·
verified ·
1 Parent(s): 0e9427b

Update llm.py

Browse files
Files changed (1) hide show
  1. llm.py +4 -5
llm.py CHANGED
@@ -23,21 +23,21 @@ def llm(img):
23
  text = pytesseract.image_to_string(img, lang='eng')
24
 
25
  # generate text
26
- prompt = {"take this piece of information and give all the information in point wise better format also give some recommendation related to them, \
27
  if you don't get any nutrition content simply reply 'I don't seem to have any knowledge of the particular Nutrition Content' " + text,
28
 
29
- "Take this Nutrition facts information and give all the contents and proportion in point wise Markdown format also give some recommendation related to them, \
30
  Make sure the Recommendations are given in bulleted format under the heading Recommendations \
31
  if you don't get any nutrition content simply reply 'I don't seem to have any knowledge of the particular Nutrition Content' " + text,
32
 
33
- "I've given you this piece of information it contains Nutrition facts, and I want you to give all the information in point-wise Markdown format also give some \
34
  recommendation related to them like how the consumption of the content may affect your health and what kind of people will be benefited or harmed from a particular, \
35
  content and its percentage if you don't get any nutrition content simply reply 'I don't seem to have any knowledge of the particular Nutrition Content' " + text
36
  }
37
 
38
  # Fit model
39
  text = palm.generate_text(
40
- prompt=prompt[0],
41
  model=model,
42
  temperature=0.3,
43
  max_output_tokens=2000,
@@ -45,5 +45,4 @@ def llm(img):
45
  top_k=40,
46
  )
47
 
48
-
49
  return text.result
 
23
  text = pytesseract.image_to_string(img, lang='eng')
24
 
25
  # generate text
26
+ prompt = { "0" : "take this piece of information and give all the information in point wise better format also give some recommendation related to them, \
27
  if you don't get any nutrition content simply reply 'I don't seem to have any knowledge of the particular Nutrition Content' " + text,
28
 
29
+ "1" : "Take this Nutrition facts information and give all the contents and proportion in point wise Markdown format also give some recommendation related to them, \
30
  Make sure the Recommendations are given in bulleted format under the heading Recommendations \
31
  if you don't get any nutrition content simply reply 'I don't seem to have any knowledge of the particular Nutrition Content' " + text,
32
 
33
+ "2" : "I've given you this piece of information it contains Nutrition facts, and I want you to give all the information in point-wise Markdown format also give some \
34
  recommendation related to them like how the consumption of the content may affect your health and what kind of people will be benefited or harmed from a particular, \
35
  content and its percentage if you don't get any nutrition content simply reply 'I don't seem to have any knowledge of the particular Nutrition Content' " + text
36
  }
37
 
38
  # Fit model
39
  text = palm.generate_text(
40
+ prompt=prompt["0"],
41
  model=model,
42
  temperature=0.3,
43
  max_output_tokens=2000,
 
45
  top_k=40,
46
  )
47
 
 
48
  return text.result