Spaces:
Runtime error
Runtime error
Update utility/utils.py
Browse files- 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'''
|
189 |
-
|
190 |
-
Please extract the following details:
|
191 |
{{
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
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
|