Martin1998 commited on
Commit
853806d
·
1 Parent(s): dfda771

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -3
app.py CHANGED
@@ -5,9 +5,9 @@ from transformers import pipeline
5
 
6
 
7
 
8
- st.title("Question - Answering AI App")
9
  st.write("---")
10
- st.write("### Give Content to the AI and quiz it based on the content.")
11
  st.warning("**Powered by AI Language Models...**")
12
 
13
  st.write("---")
@@ -32,4 +32,25 @@ if uploaded_file is not None:
32
 
33
  # Can be used wherever a "file-like" object is accepted:
34
  dataframe = pd.read_csv(uploaded_file)
35
- st.write(dataframe)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
 
6
 
7
 
8
+ st.title("Docs Answering AI App")
9
  st.write("---")
10
+ st.write("### Give Doc Receipt Images to the AI and ask it whats on the receipt.")
11
  st.warning("**Powered by AI Language Models...**")
12
 
13
  st.write("---")
 
32
 
33
  # Can be used wherever a "file-like" object is accepted:
34
  dataframe = pd.read_csv(uploaded_file)
35
+ st.write(dataframe)
36
+
37
+
38
+ nlp = pipeline(
39
+ "document-question-answering",
40
+ model="impira/layoutlm-document-qa",
41
+ )
42
+
43
+ res = nlp(
44
+ "https://templates.invoicehome.com/invoice-template-us-neat-750px.png",
45
+ "What is the invoice number?"
46
+ )
47
+
48
+ st.write(res['answer'])
49
+ # {'score': 0.9943977, 'answer': 'us-001', 'start': 15, 'end': 15}
50
+
51
+ res = nlp(
52
+ "https://miro.medium.com/max/787/1*iECQRIiOGTmEFLdWkVIH2g.jpeg",
53
+ "What is the purchase amount?"
54
+ )
55
+
56
+ st.write(res['answer'])