vpcom commited on
Commit
d2b97de
·
1 Parent(s): b85cf7c

fix: get the data directly from textbox_whoareu to get rid of the partial saving

Browse files
Files changed (1) hide show
  1. app.py +3 -16
app.py CHANGED
@@ -1066,10 +1066,8 @@ def vote(data: gr.LikeData):
1066
  {
1067
  "time_stamp": time.time(),
1068
  "model_version":MODEL_VERSION,
1069
- "name":NAME,
1070
- "username":USERNAME,
1071
  "prompt": PROMPT.replace('\n','؛').replace('\t','/').replace(' * ','/').replace('\u200c',' ').strip(),
1072
- "history": "", #HISTORY,
1073
  "system prompt": additional_inputs[0].value,
1074
  "temperature": additional_inputs[1].value,
1075
  "max_new_tokens": additional_inputs[2].value,
@@ -1083,16 +1081,7 @@ def vote(data: gr.LikeData):
1083
  ]
1084
  jsonlfile.write("\n".join(json_data) + "\n")
1085
 
1086
- def save_whotheyare(x):
1087
- global USERNAME
1088
- global NAME
1089
- if len(x) == 0:
1090
- USERNAME = "guest"
1091
- NAME = "guest"
1092
- else:
1093
- USERNAME = ""
1094
- NAME = x
1095
- return USERNAME
1096
  # def hello(profile: gr.OAuthProfile | None) -> str:
1097
  # global USERNAME
1098
  # global NAME
@@ -1119,9 +1108,7 @@ with gr.Blocks(css=CSS) as demo:
1119
  with gr.Column(css="""textarea {direction: ltl}
1120
  p {direction: ltl}"""):
1121
  textbox_whoareu.render()
1122
- textbox_whoareu.change(fn=save_whotheyare,
1123
- inputs=textbox_whoareu,
1124
- outputs=None)
1125
  # gr.Markdown().attach_load_event(hello, None)
1126
  # with gr.Row():
1127
  # with gr.Column():
 
1066
  {
1067
  "time_stamp": time.time(),
1068
  "model_version":MODEL_VERSION,
1069
+ "username":textbox_whoareu.value,
 
1070
  "prompt": PROMPT.replace('\n','؛').replace('\t','/').replace(' * ','/').replace('\u200c',' ').strip(),
 
1071
  "system prompt": additional_inputs[0].value,
1072
  "temperature": additional_inputs[1].value,
1073
  "max_new_tokens": additional_inputs[2].value,
 
1081
  ]
1082
  jsonlfile.write("\n".join(json_data) + "\n")
1083
 
1084
+
 
 
 
 
 
 
 
 
 
1085
  # def hello(profile: gr.OAuthProfile | None) -> str:
1086
  # global USERNAME
1087
  # global NAME
 
1108
  with gr.Column(css="""textarea {direction: ltl}
1109
  p {direction: ltl}"""):
1110
  textbox_whoareu.render()
1111
+
 
 
1112
  # gr.Markdown().attach_load_event(hello, None)
1113
  # with gr.Row():
1114
  # with gr.Column():