Rsnarsna commited on
Commit
9505475
·
verified ·
1 Parent(s): 4b8a252

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -10
app.py CHANGED
@@ -179,19 +179,12 @@ llm = Llama(model_path='./ggml-model-q8_0.gguf', n_ctx=2048)
179
  def read_email():
180
  df = pd.read_csv('./emails.csv')
181
  for i in df['Body']:
182
- prompt_ = f"<s>system:{prompt}<|end|><s>user:{i}<|end|<s>assistant:"
183
  output = llm(prompt_, max_tokens=1000, temperature=0.1)
 
184
  print("*"*50)
185
  t = output['choices'][0]['text']
186
- if len(t)==0:
187
- print('input : ',i)
188
- print('output : ',t)
189
- # t = t[t.find('json\n')+len('json\n'):]
190
- extracted_details = json.loads(t)
191
- else:
192
- continue
193
-
194
- print(extracted_details)
195
  # print(extracted_details)
196
  print(type(extracted_details))
197
  meta_data = {
 
179
  def read_email():
180
  df = pd.read_csv('./emails.csv')
181
  for i in df['Body']:
182
+ prompt_ = f"<s>system:{prompt}<|end|><s>user:{i}<|end|><s>assistant:"
183
  output = llm(prompt_, max_tokens=1000, temperature=0.1)
184
+
185
  print("*"*50)
186
  t = output['choices'][0]['text']
187
+ extracted_details = json.loads(t[t.find('{'):t.find('}')+1])
 
 
 
 
 
 
 
 
188
  # print(extracted_details)
189
  print(type(extracted_details))
190
  meta_data = {