Spaces:
Running
on
Zero
Running
on
Zero
Jimhugging
commited on
Commit
•
93f18de
1
Parent(s):
8300af2
Update app.py
Browse files
app.py
CHANGED
@@ -162,10 +162,80 @@ chat_input = gr.MultimodalTextbox(
|
|
162 |
placeholder="Enter message or upload a file one time...",
|
163 |
show_label=False,
|
164 |
|
165 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
166 |
EXAMPLES = [
|
167 |
-
[{"text":
|
168 |
-
[{"text":
|
169 |
[{"text": "Is it real?", "files": ["./spacecat.png"]}]
|
170 |
]
|
171 |
|
|
|
162 |
placeholder="Enter message or upload a file one time...",
|
163 |
show_label=False,
|
164 |
|
165 |
+
)
|
166 |
+
|
167 |
+
prompt_extraction = '''
|
168 |
+
Please extract the Key information from the given document, including:
|
169 |
+
1 Date (DD/MM/YY)
|
170 |
+
2 Name(s) of Account Holder(s)
|
171 |
+
3 ID Document No.
|
172 |
+
4 ID Document Type
|
173 |
+
5 (Checked?)Are you the existing Personal e-Banking user?(expected result: yes/no)
|
174 |
+
6 (Checked?)Delete all Registered Bill Account Numbers for bill payment via any accounts under the above-mentioned ID Document or Business Registration No...(expected result: yes/no)
|
175 |
+
7 (Checked?)Add the following Bill Account Numbers for bill payment via any accounts under the above-mentioned ID Document or Business Registration No...(expected result: yes/no)
|
176 |
+
8 Signature(s) of Account Holder(s)
|
177 |
+
9 Account No.
|
178 |
+
|
179 |
+
Please Notice:
|
180 |
+
Return in JSON format, plain(no nested structure)
|
181 |
+
9 keys as listed in Objective section, don't ignore any item from the list even the value is None.
|
182 |
+
Please note:
|
183 |
+
Your accuracy of detecting checkboxes is relatively low, and unchecked boxes are often mistakenly identified as checked/true (resulting in many false positives).
|
184 |
+
Therefore, for all fields marked "(Checked?)", please be extra cautious and carefully examine the image before extracting the information, and if you are unsure, please default to false.
|
185 |
+
'''
|
186 |
+
prompt_signature = '''
|
187 |
+
I need your help to compare and score the similarity of two signatures. You should evaluate the signatures based on several dimensions and calculate a final similarity score. Here are the detailed instructions and dimensions for the comparison:
|
188 |
+
|
189 |
+
1. **General Shape and Flow**:
|
190 |
+
- Compare the overall shape and flow of the two signatures.
|
191 |
+
- Score from 0 to 10, where 0 means completely different and 10 means identical.
|
192 |
+
|
193 |
+
2. **Consistency of Loops and Strokes**:
|
194 |
+
- Evaluate the presence and consistency of loops and strokes in the signatures.
|
195 |
+
- Score from 0 to 10 based on the similarity of these features.
|
196 |
+
|
197 |
+
3. **Signature Characteristics**:
|
198 |
+
- Compare specific characteristics such as dots, dashes, and unique flourishes.
|
199 |
+
- Score from 0 to 10 based on the presence and similarity of these unique features.
|
200 |
+
|
201 |
+
4. **Stroke Pressure and Line Thickness**:
|
202 |
+
- Analyze the pressure and thickness of the lines in the signatures.
|
203 |
+
- Score from 0 to 10 based on how similar the pressure and thickness are between the two signatures.
|
204 |
+
|
205 |
+
5. **Angle and Slope**:
|
206 |
+
- Evaluate the angle and slope of the characters in the signatures.
|
207 |
+
- Score from 0 to 10 based on how similar the angles and slopes are.
|
208 |
+
|
209 |
+
6. **Spacing and Proportions**:
|
210 |
+
- Compare the spacing between characters and the proportions of the signatures.
|
211 |
+
- Score from 0 to 10 based on the similarity of spacing and proportions.
|
212 |
+
|
213 |
+
After scoring each dimension, calculate the final similarity score by averaging the scores from all dimensions. The final similarity score should be a value between 0 and 10, where 0 indicates no similarity and 10 indicates identical signatures.
|
214 |
+
|
215 |
+
Here is an example output format for the comparison:
|
216 |
+
|
217 |
+
```
|
218 |
+
General Shape and Flow: 8
|
219 |
+
Consistency of Loops and Strokes: 7
|
220 |
+
Signature Characteristics: 6
|
221 |
+
Stroke Pressure and Line Thickness: 5
|
222 |
+
Angle and Slope: 8
|
223 |
+
Spacing and Proportions: 7
|
224 |
+
|
225 |
+
Final Similarity Score: 6.83
|
226 |
+
```
|
227 |
+
|
228 |
+
Please help with this comparison and scoring for the two provided signatures.
|
229 |
+
|
230 |
+
Important: Only score based on visual intuition, do not run code or provide coding solutions
|
231 |
+
'''
|
232 |
+
|
233 |
+
|
234 |
+
|
235 |
+
|
236 |
EXAMPLES = [
|
237 |
+
[{"text": prompt_extraction, "files": ["./IMG_2700.png"]}],
|
238 |
+
[{"text": prompt_signature , "files": ["./2.jpg"]}],
|
239 |
[{"text": "Is it real?", "files": ["./spacecat.png"]}]
|
240 |
]
|
241 |
|