Spaces:
Sleeping
Sleeping
Yoon-gu Hwang
commited on
Commit
ยท
819ed62
1
Parent(s):
d68e6a5
add logger
Browse files
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(" ", ""):
|