Update app.py
Browse files
app.py
CHANGED
|
@@ -7,8 +7,9 @@ from PIL import Image
|
|
| 7 |
import pdfplumber
|
| 8 |
import io
|
| 9 |
|
|
|
|
| 10 |
genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))
|
| 11 |
-
#
|
| 12 |
model = genai.GenerativeModel("gemini-1.5-flash")
|
| 13 |
|
| 14 |
def get_gemini_response(input, image, prompt):
|
|
@@ -56,10 +57,21 @@ def input_file_setup(uploaded_file):
|
|
| 56 |
|
| 57 |
st.set_page_config(page_title="Invoice Information Extractor", page_icon="๐ฎ")
|
| 58 |
st.title("Invoice Information Extractor ๐")
|
| 59 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
|
| 61 |
uploaded_file = st.file_uploader("Upload an Invoice Image ๐ผ๏ธ or PDF ๐", type=["jpg", "jpeg", "png", "pdf"])
|
| 62 |
-
input_query = st.text_input("Ask a question", key="input")
|
| 63 |
|
| 64 |
if uploaded_file is not None:
|
| 65 |
if uploaded_file.type.startswith('image'):
|
|
|
|
| 7 |
import pdfplumber
|
| 8 |
import io
|
| 9 |
|
| 10 |
+
# Configure API key
|
| 11 |
genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))
|
| 12 |
+
# Load gemini model
|
| 13 |
model = genai.GenerativeModel("gemini-1.5-flash")
|
| 14 |
|
| 15 |
def get_gemini_response(input, image, prompt):
|
|
|
|
| 57 |
|
| 58 |
st.set_page_config(page_title="Invoice Information Extractor", page_icon="๐ฎ")
|
| 59 |
st.title("Invoice Information Extractor ๐")
|
| 60 |
+
|
| 61 |
+
st.write("Upload your invoice (image or PDF) and ask a question related to the invoice. Here are some example prompts:")
|
| 62 |
+
|
| 63 |
+
# Display sample prompts
|
| 64 |
+
st.subheader("Sample Prompts:")
|
| 65 |
+
sample_prompts = [
|
| 66 |
+
"What is the total amount?",
|
| 67 |
+
'What are the Customter details?' ,
|
| 68 |
+
'What is the information about the Products?'
|
| 69 |
+
]
|
| 70 |
+
for prompt in sample_prompts:
|
| 71 |
+
st.write(f"- {prompt}")
|
| 72 |
|
| 73 |
uploaded_file = st.file_uploader("Upload an Invoice Image ๐ผ๏ธ or PDF ๐", type=["jpg", "jpeg", "png", "pdf"])
|
| 74 |
+
input_query = st.text_input("Ask a question about the invoice", key="input")
|
| 75 |
|
| 76 |
if uploaded_file is not None:
|
| 77 |
if uploaded_file.type.startswith('image'):
|