archana2324 commited on
Commit
d4df47d
·
verified ·
1 Parent(s): afaef4c

Update backend.py

Browse files
Files changed (1) hide show
  1. backend.py +7 -4
backend.py CHANGED
@@ -6,7 +6,8 @@ from typing import List, Dict
6
  from langchain.prompts import PromptTemplate
7
  from langchain_google_genai import GoogleGenerativeAI
8
 
9
- os.environ["GOOGLE_API_KEY"] = "AIzaSyCYGj5e2eAQbUi9HtuMaW0LDSnDuxLG54U"
 
10
 
11
 
12
  class InvoicePipeline:
@@ -18,14 +19,14 @@ class InvoicePipeline:
18
  # This funcition will help in extracting and run the code, and will produce a dataframe for us
19
  def run(self) -> pd.DataFrame:
20
  # We have defined the way the data has to be returned
21
- df = pd.DataFrame(
22
  "Invoice ID": pd.Series(dtype = "int"),
23
  "DESCRIPTION": pd.Series(dtype = "str"),
24
  "Issue Data": pd.Series(dtype = "str"),
25
  "UNIT PRICE": pd.Series(dtype = "str"),
26
  "AMOUNT": pd.Series(dtype = "int"),
27
  "Bill For": pd.Series(dtype = "str"),
28
- "From": pd.Series(dtype =" str"),
29
  "Terms": pd.Series(dtype = "str")}
30
  )
31
 
@@ -57,4 +58,6 @@ class InvoicePipeline:
57
 
58
  def _extract_data_from_llm(self, raw_data:str) -> str:
59
  resp = self._llm(self._prompt_template.format(pages = raw_data))
60
- return resp
 
 
 
6
  from langchain.prompts import PromptTemplate
7
  from langchain_google_genai import GoogleGenerativeAI
8
 
9
+
10
+ api_key = "AIzaSyCYGj5e2eAQbUi9HtuMaW0LDSnDuxLG54U"
11
 
12
 
13
  class InvoicePipeline:
 
19
  # This funcition will help in extracting and run the code, and will produce a dataframe for us
20
  def run(self) -> pd.DataFrame:
21
  # We have defined the way the data has to be returned
22
+ df = pd.DataFrame({
23
  "Invoice ID": pd.Series(dtype = "int"),
24
  "DESCRIPTION": pd.Series(dtype = "str"),
25
  "Issue Data": pd.Series(dtype = "str"),
26
  "UNIT PRICE": pd.Series(dtype = "str"),
27
  "AMOUNT": pd.Series(dtype = "int"),
28
  "Bill For": pd.Series(dtype = "str"),
29
+ "From": pd.Series(dtype ="str"),
30
  "Terms": pd.Series(dtype = "str")}
31
  )
32
 
 
58
 
59
  def _extract_data_from_llm(self, raw_data:str) -> str:
60
  resp = self._llm(self._prompt_template.format(pages = raw_data))
61
+ return resp
62
+
63
+