Spaces:
Sleeping
Sleeping
Update helper/process_image.py
Browse files- helper/process_image.py +1 -2
helper/process_image.py
CHANGED
@@ -25,7 +25,7 @@ if about_company_doc:
|
|
25 |
system_prompt_text = f"""Given is an image related to a company. Your task is to analyze the image, identify any text or notable visual elements, and provide a comprehensive, direct description of the image's contents, focusing on what it represents without abstract language or additional commentary. The response must be concise and focused, using only descriptive nouns and adjectives. If the image cannot be clearly described, respond with 'None.'
|
26 |
Company information is given below to understand the context.
|
27 |
- About Company: {about_company}
|
28 |
-
|
29 |
Expected Output format : {{"description":"String"}}
|
30 |
"""
|
31 |
|
@@ -52,7 +52,6 @@ def process_image_using_llm(image_url):
|
|
52 |
match = re.search(r"\{.*\}", response.content.strip())
|
53 |
if match:
|
54 |
json_data = match.group(0) # Extract JSON-like content as a string
|
55 |
-
json_data = json_data.replace("'", '"')
|
56 |
data = json.loads(json_data) # Load as JSON
|
57 |
|
58 |
# Get the description from the JSON data
|
|
|
25 |
system_prompt_text = f"""Given is an image related to a company. Your task is to analyze the image, identify any text or notable visual elements, and provide a comprehensive, direct description of the image's contents, focusing on what it represents without abstract language or additional commentary. The response must be concise and focused, using only descriptive nouns and adjectives. If the image cannot be clearly described, respond with 'None.'
|
26 |
Company information is given below to understand the context.
|
27 |
- About Company: {about_company}
|
28 |
+
Ensure you give a valid JSON structure.
|
29 |
Expected Output format : {{"description":"String"}}
|
30 |
"""
|
31 |
|
|
|
52 |
match = re.search(r"\{.*\}", response.content.strip())
|
53 |
if match:
|
54 |
json_data = match.group(0) # Extract JSON-like content as a string
|
|
|
55 |
data = json.loads(json_data) # Load as JSON
|
56 |
|
57 |
# Get the description from the JSON data
|