Update app.py
Browse files
app.py
CHANGED
@@ -33,7 +33,7 @@ def get_gemini_response(input_prompt, uploaded_file_path, query):
|
|
33 |
return f"Error: {e}"
|
34 |
|
35 |
# Define input prompt
|
36 |
-
|
37 |
You are an expert in understanding invoices. You will receive input images as invoices and
|
38 |
you will have to answer questions based on the input image.
|
39 |
"""
|
@@ -48,7 +48,8 @@ with gr.Blocks() as invoice_extractor:
|
|
48 |
"""
|
49 |
)
|
50 |
|
51 |
-
|
|
|
52 |
image_input = gr.Image(label="Upload Invoice Image", type="filepath") # Use type="filepath"
|
53 |
query_input = gr.Textbox(label="Enter your query about the invoice", placeholder="e.g., What is the total amount?")
|
54 |
output_response = gr.Textbox(label="Response", lines=5)
|
@@ -59,7 +60,7 @@ with gr.Blocks() as invoice_extractor:
|
|
59 |
# Set the button to call the processing function
|
60 |
submit_btn.click(
|
61 |
get_gemini_response,
|
62 |
-
inputs=[
|
63 |
outputs=output_response
|
64 |
)
|
65 |
|
|
|
33 |
return f"Error: {e}"
|
34 |
|
35 |
# Define input prompt
|
36 |
+
default_prompt = """
|
37 |
You are an expert in understanding invoices. You will receive input images as invoices and
|
38 |
you will have to answer questions based on the input image.
|
39 |
"""
|
|
|
48 |
"""
|
49 |
)
|
50 |
|
51 |
+
input_prompt = default_prompt
|
52 |
+
# gr.Textbox(label="Input Prompt", value=default_prompt, lines=2)
|
53 |
image_input = gr.Image(label="Upload Invoice Image", type="filepath") # Use type="filepath"
|
54 |
query_input = gr.Textbox(label="Enter your query about the invoice", placeholder="e.g., What is the total amount?")
|
55 |
output_response = gr.Textbox(label="Response", lines=5)
|
|
|
60 |
# Set the button to call the processing function
|
61 |
submit_btn.click(
|
62 |
get_gemini_response,
|
63 |
+
inputs=[input_prompt, image_input, query_input],
|
64 |
outputs=output_response
|
65 |
)
|
66 |
|