Update llm.py
Browse files
llm.py
CHANGED
@@ -9,14 +9,6 @@ api_key = os.environ["GOOGLE_API_KEY"] # put your API key here
|
|
9 |
palm.configure(api_key=api_key)
|
10 |
|
11 |
models = [m for m in palm.list_models() if 'generateText' in m.supported_generation_methods]
|
12 |
-
|
13 |
-
|
14 |
-
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 |
-
|
20 |
model = models[0].name
|
21 |
|
22 |
def llm(img):
|
@@ -34,8 +26,7 @@ def llm(img):
|
|
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,
|
@@ -44,5 +35,4 @@ def llm(img):
|
|
44 |
top_p=0.8,
|
45 |
top_k=40,
|
46 |
)
|
47 |
-
|
48 |
return text.result
|
|
|
9 |
palm.configure(api_key=api_key)
|
10 |
|
11 |
models = [m for m in palm.list_models() if 'generateText' in m.supported_generation_methods]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
model = models[0].name
|
13 |
|
14 |
def llm(img):
|
|
|
26 |
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, \
|
27 |
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
|
28 |
}
|
29 |
+
|
|
|
30 |
text = palm.generate_text(
|
31 |
prompt=prompt["0"],
|
32 |
model=model,
|
|
|
35 |
top_p=0.8,
|
36 |
top_k=40,
|
37 |
)
|
|
|
38 |
return text.result
|