suhyun.kang commited on
Commit
47db0c3
1 Parent(s): 382f0f6
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -35,6 +35,7 @@ class VoteOptions(enum.Enum):
35
 
36
 
37
  def vote(state_a, state_b, vote_button, res_type, source_lang, target_lang):
 
38
  winner = VoteOptions(vote_button).name.lower()
39
 
40
  # The 'messages' field in the state is an array of arrays, a data type
@@ -43,8 +44,9 @@ def vote(state_a, state_b, vote_button, res_type, source_lang, target_lang):
43
  model_b_conv = json.dumps(state_b.dict())
44
 
45
  if res_type == ResponseType.SUMMARIZE.value:
46
- doc_ref = db.collection("arena-summarizations").document(uuid4().hex)
47
  doc_ref.set({
 
48
  "model_a": state_a.model_name,
49
  "model_b": state_b.model_name,
50
  "model_a_conv": model_a_conv,
@@ -55,8 +57,9 @@ def vote(state_a, state_b, vote_button, res_type, source_lang, target_lang):
55
  return
56
 
57
  if res_type == ResponseType.TRANSLATE.value:
58
- doc_ref = db.collection("arena-translations").document(uuid4().hex)
59
  doc_ref.set({
 
60
  "model_a": state_a.model_name,
61
  "model_b": state_b.model_name,
62
  "model_a_conv": model_a_conv,
 
35
 
36
 
37
  def vote(state_a, state_b, vote_button, res_type, source_lang, target_lang):
38
+ doc_id = uuid4().hex
39
  winner = VoteOptions(vote_button).name.lower()
40
 
41
  # The 'messages' field in the state is an array of arrays, a data type
 
44
  model_b_conv = json.dumps(state_b.dict())
45
 
46
  if res_type == ResponseType.SUMMARIZE.value:
47
+ doc_ref = db.collection("arena-summarizations").document(doc_id)
48
  doc_ref.set({
49
+ "id": doc_id,
50
  "model_a": state_a.model_name,
51
  "model_b": state_b.model_name,
52
  "model_a_conv": model_a_conv,
 
57
  return
58
 
59
  if res_type == ResponseType.TRANSLATE.value:
60
+ doc_ref = db.collection("arena-translations").document(doc_id)
61
  doc_ref.set({
62
+ "id": doc_id,
63
  "model_a": state_a.model_name,
64
  "model_b": state_b.model_name,
65
  "model_a_conv": model_a_conv,