Yoon-gu Hwang commited on
Commit
819ed62
ยท
1 Parent(s): d68e6a5

add logger

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -6,6 +6,7 @@ import json
6
  import time
7
  import wandb
8
  from utils import Info
 
9
 
10
  wandb.login(key=os.environ['WANDB_KEY'])
11
  run = wandb.init(project="pokemon-quiz", entity="yoon-gu")
@@ -58,12 +59,13 @@ try:
58
  infos = json.load(f)
59
  for k, v in infos.items():
60
  infos[k] = Info(**v)
61
- except:
 
62
  USERS = ["๊น€์„œํ˜„", "๊น€์šฐ์ฃผ", "Anonymous"]
63
  infos = {user: Info(name=user) for user in USERS}
64
 
65
  MD = """# ํฌ์ผ“๋ชฌ ํ€ด์ฆˆ ๐Ÿฆ‘
66
- ## ๊ณต๋ถ€ ๋ฐฉ๋ฒ•
67
 
68
  ์•„๋ž˜ ํฌ์ผ“๋ชฌ ๋„๊ฐ์„ ๋ณด๊ณ  ๊ณต๋ถ€ํ•˜๋ฉด ๋„์›€์ด ๋ฉ๋‹ˆ๋‹ค.
69
  - https://huggingface.co/spaces/yoon-gu/pokemon
@@ -84,7 +86,7 @@ with gr.Blocks() as demo:
84
  markdown = gr.Markdown(MD.format(content=''))
85
  leader_board = gr.DataFrame(wrap=True, row_count=10)
86
  user = gr.Dropdown(USERS, value="Anonymous", label="์‚ฌ์šฉ์ž", info="๋‹น์‹ ์€ ๋ˆ„๊ตฌ์‹ ๊ฐ€์š”?", allow_custom_value=True)
87
- quiz_count = gr.Radio([10, 20, 30], value=10, label="์ด ํ€ด์ฆˆ ๊ฐœ์ˆ˜", info="ํ€ด์ฆˆ๋ฅผ ๋ช‡ ๊ฐœ ํ’€ ์˜ˆ์ •์ธ๊ฐ€์š”?")
88
  with gr.Column():
89
  with gr.Row():
90
  generation = gr.Dropdown(
@@ -121,7 +123,6 @@ with gr.Blocks() as demo:
121
  sdf = df[start:end]
122
  pokemons_set = sdf[sdf['types'].apply(lambda x: (types in x)) | (types == "๋ชจ๋“  ํƒ€์ž…")]
123
  pokemons_set = pokemons_set.to_dict("records")
124
- global random_buttons
125
  if done:
126
  infos[user].history = []
127
  if "ํ€ด์ฆˆ์‹œ์ž‘" == message.replace(" ", ""):
 
6
  import time
7
  import wandb
8
  from utils import Info
9
+ import logging
10
 
11
  wandb.login(key=os.environ['WANDB_KEY'])
12
  run = wandb.init(project="pokemon-quiz", entity="yoon-gu")
 
59
  infos = json.load(f)
60
  for k, v in infos.items():
61
  infos[k] = Info(**v)
62
+ except Exception as e:
63
+ logging.error(e)
64
  USERS = ["๊น€์„œํ˜„", "๊น€์šฐ์ฃผ", "Anonymous"]
65
  infos = {user: Info(name=user) for user in USERS}
66
 
67
  MD = """# ํฌ์ผ“๋ชฌ ํ€ด์ฆˆ ๐Ÿฆ‘
68
+ ## ๊ณต๋ถ€ ๋ฐฉ๋ฒ• ๐Ÿ“š
69
 
70
  ์•„๋ž˜ ํฌ์ผ“๋ชฌ ๋„๊ฐ์„ ๋ณด๊ณ  ๊ณต๋ถ€ํ•˜๋ฉด ๋„์›€์ด ๋ฉ๋‹ˆ๋‹ค.
71
  - https://huggingface.co/spaces/yoon-gu/pokemon
 
86
  markdown = gr.Markdown(MD.format(content=''))
87
  leader_board = gr.DataFrame(wrap=True, row_count=10)
88
  user = gr.Dropdown(USERS, value="Anonymous", label="์‚ฌ์šฉ์ž", info="๋‹น์‹ ์€ ๋ˆ„๊ตฌ์‹ ๊ฐ€์š”?", allow_custom_value=True)
89
+ quiz_count = gr.Radio([10, 20, 30, 40, 50], value=10, label="์ด ํ€ด์ฆˆ ๊ฐœ์ˆ˜", info="ํ€ด์ฆˆ๋ฅผ ๋ช‡ ๊ฐœ ํ’€ ์˜ˆ์ •์ธ๊ฐ€์š”?")
90
  with gr.Column():
91
  with gr.Row():
92
  generation = gr.Dropdown(
 
123
  sdf = df[start:end]
124
  pokemons_set = sdf[sdf['types'].apply(lambda x: (types in x)) | (types == "๋ชจ๋“  ํƒ€์ž…")]
125
  pokemons_set = pokemons_set.to_dict("records")
 
126
  if done:
127
  infos[user].history = []
128
  if "ํ€ด์ฆˆ์‹œ์ž‘" == message.replace(" ", ""):