yuvaranianandhan24 commited on
Commit
c93c025
·
verified ·
1 Parent(s): 9804c6f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -4
app.py CHANGED
@@ -34,8 +34,13 @@ def process_pdf(uploaded_file):
34
  for page in pages:
35
  st.write(page.page_content)
36
 
37
- llm = CTransformers(model="llama-2-7b-chat.ggmlv3.q4_0.bin", model_type="llama",
38
- config={'max_new_tokens': 128, 'temperature': 0.01})
 
 
 
 
 
39
 
40
  template = """Extract invoice number, name of organization, address, date,
41
  Qty, Rate, Tax, Amount {pages}
@@ -60,8 +65,15 @@ def process_image(uploaded_image):
60
  st.write(text)
61
 
62
  # Apply entity extraction logic to the extracted text
63
- llm = CTransformers(model="llama-2-7b-chat.ggmlv3.q4_0.bin", model_type="llama",
64
- config={'max_new_tokens': 128, 'temperature': 0.01})
 
 
 
 
 
 
 
65
 
66
  template = """Extract invoice number, name of organization, address, date,
67
  Qty, Rate, Tax, Amount {text}
 
34
  for page in pages:
35
  st.write(page.page_content)
36
 
37
+ model = "llama-2-7b-chat.ggmlv3.q4_0.bin"
38
+ llm = HuggingFaceHub(
39
+ huggingfacehub_api_token = api_token,
40
+ repo_id = model,
41
+ verbose = False,
42
+ model_kwargs = {"temperature":0.01, "max_new_tokens": 128})
43
+
44
 
45
  template = """Extract invoice number, name of organization, address, date,
46
  Qty, Rate, Tax, Amount {pages}
 
65
  st.write(text)
66
 
67
  # Apply entity extraction logic to the extracted text
68
+ #llm = CTransformers(model="llama-2-7b-chat.ggmlv3.q4_0.bin", model_type="llama",
69
+ #config={'max_new_tokens': 128, 'temperature': 0.01})
70
+
71
+ model = "llama-2-7b-chat.ggmlv3.q4_0.bin"
72
+ llm = HuggingFaceHub(
73
+ huggingfacehub_api_token = api_token,
74
+ repo_id = model,
75
+ verbose = False,
76
+ model_kwargs = {"temperature":0.01, "max_new_tokens": 128})
77
 
78
  template = """Extract invoice number, name of organization, address, date,
79
  Qty, Rate, Tax, Amount {text}