mkw18 commited on
Commit
49a6990
·
1 Parent(s): 9d6aea0
Files changed (1) hide show
  1. app.py +10 -10
app.py CHANGED
@@ -245,16 +245,16 @@ def reset_state(zh, request: gr.Request):
245
  return chatbot, messages, gr.update(value=""), gr.update(value="显示答案") if zh else gr.update(value="Show Answer"), answer, idx, gr.update(value=data['story'].strip()), False, story_key, answer_key, [], 0, [], [], zh
246
 
247
 
248
- def zh_en_trans(zh, request: gr.Request):
249
- global host_cnt
250
- host = request.client.host
251
- if not host in host_cnt:
252
- host_cnt[host] = time.time()
253
- else:
254
- elapse = time.time()-host_cnt[host]
255
- if elapse < 10:
256
- time.sleep(10-elapse)
257
- host_cnt[host] = time.time()
258
  zh = not zh
259
  data = {'refresh': zh}
260
  data=requests.post(os.environ.get("URL"), data=json.dumps(data, ensure_ascii=False).encode('utf-8')).content
 
245
  return chatbot, messages, gr.update(value=""), gr.update(value="显示答案") if zh else gr.update(value="Show Answer"), answer, idx, gr.update(value=data['story'].strip()), False, story_key, answer_key, [], 0, [], [], zh
246
 
247
 
248
+ def zh_en_trans(zh):
249
+ # global host_cnt
250
+ # host = request.client.host
251
+ # if not host in host_cnt:
252
+ # host_cnt[host] = time.time()
253
+ # else:
254
+ # elapse = time.time()-host_cnt[host]
255
+ # if elapse < 10:
256
+ # time.sleep(10-elapse)
257
+ # host_cnt[host] = time.time()
258
  zh = not zh
259
  data = {'refresh': zh}
260
  data=requests.post(os.environ.get("URL"), data=json.dumps(data, ensure_ascii=False).encode('utf-8')).content