Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -257,13 +257,28 @@ def claim_generator(input_bill_path):
|
|
| 257 |
|
| 258 |
return output['final_output']
|
| 259 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 260 |
|
| 261 |
demo = gr.Interface(
|
| 262 |
fn=claim_generator,
|
| 263 |
-
inputs=gr.Image(type="filepath", label="Upload
|
| 264 |
-
outputs=gr.Markdown(label="Expense
|
| 265 |
-
title="Expense
|
| 266 |
-
description=
|
|
|
|
| 267 |
examples='images',
|
| 268 |
cache_examples=False,
|
| 269 |
theme=gr.themes.Base(),
|
|
@@ -271,4 +286,4 @@ demo = gr.Interface(
|
|
| 271 |
)
|
| 272 |
|
| 273 |
demo.queue()
|
| 274 |
-
demo.launch(auth=("
|
|
|
|
| 257 |
|
| 258 |
return output['final_output']
|
| 259 |
|
| 260 |
+
agentic_workflow_representation = 'The workflow used to generate an expense claim document is represented below: \n <img src="https://cdn-uploads.huggingface.co/production/uploads/64118e60756b9e455c7eddd6/iqdGjUG7POKJXLItzWb-K.png">'
|
| 261 |
+
agentic_workflow_description = """
|
| 262 |
+
This demo represents a multi-agent collaborative workflow that generates an expense claim document based on a submitted bill.
|
| 263 |
+
The key steps in this workflow once the user uploads a bill are:
|
| 264 |
+
1. Extracting text from an image of the bill.
|
| 265 |
+
2. Categorizing items in the bill to: alcoholic drinks, non-alcoholic drinks and food.
|
| 266 |
+
3. Retrieving relevant sections from the company reimbursement policy and removing items that are non reimbursable.
|
| 267 |
+
4. Computing the total amount that can be reimbursed (along with taxes).
|
| 268 |
+
5. Preparing a claim document in the company format.
|
| 269 |
+
|
| 270 |
+
Each step in this workflow are executed by function-calling agents.
|
| 271 |
+
For example, the text extractor is an API-calling agent that calls uses the Open AI APIs to extract text from the bill.
|
| 272 |
+
Similarly, the verifier is a search agent that extracts relevant portions of the company policy based on the categories identified.
|
| 273 |
+
"""
|
| 274 |
|
| 275 |
demo = gr.Interface(
|
| 276 |
fn=claim_generator,
|
| 277 |
+
inputs=gr.Image(type="filepath", label="Upload an image of the bill"),
|
| 278 |
+
outputs=gr.Markdown(label="Expense Claim Document", show_copy_button=True),
|
| 279 |
+
title="Expense Claim Document Generator",
|
| 280 |
+
description=agentic_workflow_description,
|
| 281 |
+
article=agentic_workflow_representation,
|
| 282 |
examples='images',
|
| 283 |
cache_examples=False,
|
| 284 |
theme=gr.themes.Base(),
|
|
|
|
| 286 |
)
|
| 287 |
|
| 288 |
demo.queue()
|
| 289 |
+
demo.launch(auth=("johndoe", os.getenv('PASSWD')), ssr_mode=False)
|