sarim commited on
Commit
ec1c0d9
·
1 Parent(s): 4ba3023
Files changed (1) hide show
  1. app.py +29 -2
app.py CHANGED
@@ -1,4 +1,31 @@
1
  import streamlit as st
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
- x = st.slider('Select a value')
4
- st.write(x, 'squared is', x * x)
 
1
  import streamlit as st
2
+ from pydantic_ai import Agent
3
+ from pydantic_ai.models.groq import GroqModel
4
+ import nest_asyncio
5
+ import pdfplumber
6
+ import os
7
+
8
+ api_key = os.getenv("API_KEY")
9
+ data = []
10
+
11
+ #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
12
+
13
+ model = GroqModel('llama-3.1-70b-versatile', api_key = api_key)
14
+
15
+ def extract_data(feed):
16
+
17
+ with pdfplumber.load(feed) as pdf:
18
+ pages = pdf.pages
19
+ for p in pages:
20
+ data.append(p.extract_tables())
21
+ return None
22
+
23
+ uploaded_file = st.file_uploader('Choose your .pdf file', type="pdf")
24
+ if uploaded_file is not None:
25
+ df = extract_data(uploaded_file)
26
+
27
+ if data is not None:
28
+ st.caption(data)
29
+
30
+
31