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

Update utility/utils.py

Browse files
Files changed (1) hide show
  1. utility/utils.py +10 -14
utility/utils.py CHANGED
@@ -185,22 +185,18 @@ def extract_text_from_images(image_paths):
185
 
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."],
193
- "Designation": ["Extract all designations or job titles mentioned in the text."],
194
- "Company": ["Extract all company or organization names if mentioned."],
195
- "Contact": ["Extract all phone numbers, including country codes if present."],
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
 
185
 
186
  # Function to call the Gemma model and process the output as Json
187
  def Data_Extractor(data, client=client):
188
+ text = f'''Act as a Text extractor for the following text given in text: {data}
189
+ extract text in the following output JSON string:
 
190
  {{
191
+ "Name": ["Identify and Extract All the person's name from the text."],
192
+ "Designation": ["Extract All the designation or job title mentioned in the text."],
193
+ "Company": ["Extract All the company or organization name if mentioned."],
194
+ "Contact": ["Extract All phone number, including country codes if present."],
195
+ "Address": ["Extract All the full postal address or location mentioned in the text."],
196
+ "Email": ["Identify and Extract All valid email addresses mentioned in the text else 'Not found'."],
197
+ "Link": ["Identify and Extract any website URLs or social media links present in the text."]
198
  }}
199
+ Output:
 
 
 
200
  '''
201
 
202
  # Call the API for inference