WebashalarForML commited on
Commit
de57c44
·
verified ·
1 Parent(s): bae46d8

Update utility/utils.py

Browse files
Files changed (1) hide show
  1. utility/utils.py +4 -5
utility/utils.py CHANGED
@@ -186,8 +186,7 @@ def extract_text_from_images(image_paths):
186
  # Function to call the Gemma model and process the output as Json
187
  def Data_Extractor(data, client=client):
188
  text = f'''<s>[INST] Act as a Text extractor for the following text given in text: {data}.
189
- Your task is to extract specific information and return it in a JSON format as outlined below:
190
-
191
  Please extract the following details:
192
  {{
193
  "Name": ["Identify and extract all the person's names from the text."],
@@ -197,12 +196,12 @@ def Data_Extractor(data, client=client):
197
  "Address": ["Extract all full postal addresses or locations mentioned in the text."],
198
  "Email": ["Identify and extract all valid email addresses mentioned in the text; if none are found, return 'Not found'."],
199
  "Link": ["Identify and extract any website URLs or social media links present in the text."]
200
- }}
201
-
202
  Output:
203
  [/INST]</s> [INST]
204
  Return the extracted information in JSON format as follows:
205
- [/INST]'''
 
206
 
207
  # Call the API for inference
208
  response = client.text_generation(text, max_new_tokens=1000)#, temperature=0.4, top_k=50, top_p=0.9, repetition_penalty=1.2)
 
186
  # Function to call the Gemma model and process the output as Json
187
  def Data_Extractor(data, client=client):
188
  text = f'''<s>[INST] Act as a Text extractor for the following text given in text: {data}.
189
+ Your task is to extract specific information and return it in a JSON format as outlined below:
 
190
  Please extract the following details:
191
  {{
192
  "Name": ["Identify and extract all the person's names from the text."],
 
196
  "Address": ["Extract all full postal addresses or locations mentioned in the text."],
197
  "Email": ["Identify and extract all valid email addresses mentioned in the text; if none are found, return 'Not found'."],
198
  "Link": ["Identify and extract any website URLs or social media links present in the text."]
199
+ }}
 
200
  Output:
201
  [/INST]</s> [INST]
202
  Return the extracted information in JSON format as follows:
203
+ [/INST]
204
+ '''
205
 
206
  # Call the API for inference
207
  response = client.text_generation(text, max_new_tokens=1000)#, temperature=0.4, top_k=50, top_p=0.9, repetition_penalty=1.2)