smishr-18 commited on
Commit
d879412
·
verified ·
1 Parent(s): 260ee1a

Update llm.py

Browse files
Files changed (1) hide show
  1. llm.py +5 -3
llm.py CHANGED
@@ -15,11 +15,13 @@ def modelinfo():
15
  model = [ model for model in palm.list_models() ]
16
  for m in model:
17
  print(f" Model Name: {m.name} \n Display Name: {m.display_name} \n Token Limit: {m.input_token_limit} , {m.output_token_limit} \n Temperature: {m.temperature} \n")
 
18
 
19
  model = models[0].name
20
 
21
  def llm(img):
22
  text = pytesseract.image_to_string(img, lang='eng')
 
23
  # generate text
24
  prompt = {"take this piece of information and give all the information in point wise better format also give some recommendation related to them, \
25
  if you don't get any nutrition content simply reply 'I don't seem to have any knowledge of the particular Nutrition Content' " + text,
@@ -33,7 +35,7 @@ def llm(img):
33
  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
34
  }
35
 
36
-
37
  text = palm.generate_text(
38
  prompt=prompt[0],
39
  model=model,
@@ -42,6 +44,6 @@ def llm(img):
42
  top_p=0.8,
43
  top_k=40,
44
  )
45
- return text.result
46
-
47
 
 
 
 
15
  model = [ model for model in palm.list_models() ]
16
  for m in model:
17
  print(f" Model Name: {m.name} \n Display Name: {m.display_name} \n Token Limit: {m.input_token_limit} , {m.output_token_limit} \n Temperature: {m.temperature} \n")
18
+
19
 
20
  model = models[0].name
21
 
22
  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,
 
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,
 
44
  top_p=0.8,
45
  top_k=40,
46
  )
 
 
47
 
48
+
49
+ return text.result