Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -45,6 +45,9 @@ tax_deductions = '''Extract the following information in the given format:
|
|
45 |
'''
|
46 |
|
47 |
def demo(image_name, prompt):
|
|
|
|
|
|
|
48 |
messages = [
|
49 |
{
|
50 |
"role": "user",
|
@@ -58,6 +61,8 @@ def demo(image_name, prompt):
|
|
58 |
}
|
59 |
]
|
60 |
|
|
|
|
|
61 |
# Preparation for inference
|
62 |
text = processor.apply_chat_template(
|
63 |
messages, tokenize=False, add_generation_prompt=True
|
@@ -97,7 +102,10 @@ def demo(image_name, prompt):
|
|
97 |
def process_document(image):
|
98 |
print(f"Received Image --->>>>>> {image}")
|
99 |
if isinstance(image, np.ndarray):
|
|
|
100 |
image = Image.fromarray(image)
|
|
|
|
|
101 |
one = demo(image, other_benifits)
|
102 |
two = demo(image, tax_deductions)
|
103 |
json_op = {
|
|
|
45 |
'''
|
46 |
|
47 |
def demo(image_name, prompt):
|
48 |
+
|
49 |
+
print("Inside Demo")
|
50 |
+
|
51 |
messages = [
|
52 |
{
|
53 |
"role": "user",
|
|
|
61 |
}
|
62 |
]
|
63 |
|
64 |
+
print(f"Formulated prompt template {messages}")
|
65 |
+
|
66 |
# Preparation for inference
|
67 |
text = processor.apply_chat_template(
|
68 |
messages, tokenize=False, add_generation_prompt=True
|
|
|
102 |
def process_document(image):
|
103 |
print(f"Received Image --->>>>>> {image}")
|
104 |
if isinstance(image, np.ndarray):
|
105 |
+
print("Image is in Numpy array")
|
106 |
image = Image.fromarray(image)
|
107 |
+
print(type(image))
|
108 |
+
print("Proceeding with the demo")
|
109 |
one = demo(image, other_benifits)
|
110 |
two = demo(image, tax_deductions)
|
111 |
json_op = {
|