dinhquangson
commited on
Commit
•
bb45124
1
Parent(s):
1109b63
Update llm.py
Browse files
llm.py
CHANGED
@@ -1,22 +1,16 @@
|
|
1 |
import pytesseract
|
2 |
|
3 |
-
import google.generativeai as
|
4 |
api_key = 'AIzaSyB7-RzBwTAfVA-7ZGk2mEOQwOxshpwzhpM' # put your API key here
|
5 |
palm.configure(api_key=api_key)
|
6 |
-
|
7 |
-
|
8 |
|
9 |
def llm(img):
|
10 |
text = pytesseract.image_to_string(img, lang='vie')
|
11 |
# generate text
|
12 |
-
prompt = "take this peace of information and give all the information in point wise better format also give some recomendation related to them
|
13 |
# print(prompt)
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
temperature=0.2,
|
18 |
-
max_output_tokens=2000,
|
19 |
-
top_p=0.8,
|
20 |
-
top_k=40,
|
21 |
-
)
|
22 |
-
return text.result
|
|
|
1 |
import pytesseract
|
2 |
|
3 |
+
import google.generativeai as genai
|
4 |
api_key = 'AIzaSyB7-RzBwTAfVA-7ZGk2mEOQwOxshpwzhpM' # put your API key here
|
5 |
palm.configure(api_key=api_key)
|
6 |
+
geminiModel = genai.GenerativeModel(model_name='gemini-pro')
|
7 |
+
|
8 |
|
9 |
def llm(img):
|
10 |
text = pytesseract.image_to_string(img, lang='vie')
|
11 |
# generate text
|
12 |
+
prompt = "take this peace of information and give all the information in point wise better format also give some recomendation related to them' " + text
|
13 |
# print(prompt)
|
14 |
+
response = model.generate_content(prompt)
|
15 |
+
|
16 |
+
return response.text
|
|
|
|
|
|
|
|
|
|
|
|