vtrv.vls commited on
Commit
2103f08
·
1 Parent(s): e357d2f
Files changed (2) hide show
  1. app.py +1 -5
  2. utils.py +4 -1
app.py CHANGED
@@ -15,13 +15,9 @@ TINY_LLAMA = None
15
  S3_SESSION = None
16
 
17
  def giga_gen(content, chat_history):
18
- if chat_history is None:
19
- chat_history = []
20
- else:
21
- chat_history.append(("user", content))
22
  print(chat_history)
23
  res = generate(chat_history,'auth_token.json')
24
- chat_history.append(("assistant", res))
25
  send_to_s3(res, f'protobench/giga_{str(datetime.now()).replace(" ", "_")}.json', S3_SESSION)
26
  print(chat_history)
27
  return '', chat_history
 
15
  S3_SESSION = None
16
 
17
  def giga_gen(content, chat_history):
 
 
 
 
18
  print(chat_history)
19
  res = generate(chat_history,'auth_token.json')
20
+ chat_history.append((content, res))
21
  send_to_s3(res, f'protobench/giga_{str(datetime.now()).replace(" ", "_")}.json', S3_SESSION)
22
  print(chat_history)
23
  return '', chat_history
utils.py CHANGED
@@ -61,7 +61,10 @@ def generate(content=None, auth_file=None):
61
  with open(auth_file) as f:
62
  auth_token = json.load(f)
63
 
64
- content = [{'role': x[0], 'content': x[1]} for x in content]
 
 
 
65
 
66
  resp = get_text(content, auth_token['access_token'])
67
 
 
61
  with open(auth_file) as f:
62
  auth_token = json.load(f)
63
 
64
+ content_giga = []
65
+ for step in content:
66
+ content_giga.append({'role': 'user', 'content': step[0]})
67
+ content_giga.append({'role': 'assistant', 'content': step[1]})
68
 
69
  resp = get_text(content, auth_token['access_token'])
70