Spaces:
Sleeping
Sleeping
Kim Adams commited on
Commit ·
2f6fe1e
1
Parent(s): dbadc0d
constants
Browse files
create_games/data/game_ideas.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
[
|
| 2 |
{
|
| 3 |
-
"Name": "Food
|
| 4 |
-
"Description": "Players take turns drawing a food item
|
| 5 |
-
"Rationale": "This game
|
| 6 |
}
|
| 7 |
]
|
|
|
|
| 1 |
[
|
| 2 |
{
|
| 3 |
+
"Name": "Food Frenzy",
|
| 4 |
+
"Description": "Players take turns drawing a food item on a piece of paper. The other players must guess what the food item is. The player who guesses correctly first gets a point. The player with the most points at the end of the game wins.",
|
| 5 |
+
"Rationale": "This game is simple and easy to play with a small group, and encourages creativity and imagination."
|
| 6 |
}
|
| 7 |
]
|
home_view/__pycache__/ui_home.cpython-311.pyc
CHANGED
|
Binary files a/home_view/__pycache__/ui_home.cpython-311.pyc and b/home_view/__pycache__/ui_home.cpython-311.pyc differ
|
|
|
home_view/ui_home.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import pandas as pd
|
| 3 |
from home_view.app_theme import SoftBlue
|
|
|
|
| 4 |
from sketch import sketch as sk
|
| 5 |
from slack_processing.slack_data_prep import FetchSlack, ProcessSlack, CreateEmbeddings
|
| 6 |
from create_games.create_games_slack import LoadThemes,GetPlayers,CreateGameForGroup,GetPeopleByThemesDF
|
|
@@ -24,7 +25,6 @@ def FetchData():
|
|
| 24 |
return startDF, slackDF, embeddingsDF, playersDF, gamesDF
|
| 25 |
|
| 26 |
def Init():
|
| 27 |
-
print("in init)")
|
| 28 |
global startDF, slackDF, embeddingsDF, gamesDF,players,playersDF,playersValues
|
| 29 |
startDF=FetchSlack()
|
| 30 |
slackDF=ProcessSlack()
|
|
@@ -46,8 +46,6 @@ def SetSelected(playersCB):
|
|
| 46 |
break
|
| 47 |
|
| 48 |
def PlayGame():
|
| 49 |
-
print("PlayGame:")
|
| 50 |
-
#ui.add_child(home)
|
| 51 |
return gr.update(visible=True)
|
| 52 |
|
| 53 |
def Predict(sketch):
|
|
@@ -57,11 +55,11 @@ def Predict(sketch):
|
|
| 57 |
def CreateGame():
|
| 58 |
global players,gameTitle
|
| 59 |
game_ideas = CreateGameForGroup(players)
|
| 60 |
-
print("CreateGame:", game_ideas)
|
| 61 |
if not game_ideas is None:
|
| 62 |
game_ideas_dict = game_ideas.to_dict('records')
|
| 63 |
return game_ideas, game_ideas_dict[0]['Description'],game_ideas_dict[0]['Name']
|
| 64 |
-
return None,
|
| 65 |
|
| 66 |
df1 =gr.Dataframe(type="pandas", value=startDF)
|
| 67 |
df2 =gr.Dataframe(type="pandas", value=slackDF)
|
|
@@ -71,24 +69,24 @@ df5 =gr.Dataframe(type="pandas", value=gamesDF)
|
|
| 71 |
|
| 72 |
with gr.Blocks() as ui:
|
| 73 |
with gr.Row():
|
| 74 |
-
logo=gr.Image(value=
|
| 75 |
-
directions= gr.
|
| 76 |
with gr.Column():
|
| 77 |
-
playersCB = gr.CheckboxGroup ([], label=
|
| 78 |
-
createBtn = gr.Button(value=
|
| 79 |
-
gameTitle=gr.Markdown(
|
| 80 |
-
desc=gr.TextArea(info=
|
| 81 |
-
placeholder=
|
| 82 |
-
playBtn = gr.Button(value=
|
| 83 |
with gr.Row(visible=False) as holder:
|
| 84 |
sketch=gr.Image(image_mode="L", source="canvas", width=600, height =600, invert_colors=True, interactive=True,
|
| 85 |
-
brush_radius=.5,type="numpy",label="Sketch", show_label=True, show_download_button=False)
|
| 86 |
label=gr.Label()
|
| 87 |
sketch.change(Predict, inputs=[sketch], outputs=[label])
|
| 88 |
|
| 89 |
with gr.Blocks() as dfs:
|
| 90 |
-
fetchBtn=gr.Button(value=
|
| 91 |
-
gr.TabbedInterface([df1,df2,df3,df4,df5], (
|
| 92 |
fetchBtn.click(FetchData, inputs=[], outputs=[df1,df2,df3,df4,df5])
|
| 93 |
playersCB.change(SetSelected, inputs=[playersCB], outputs=[])
|
| 94 |
createBtn.click(CreateGame, inputs=[], outputs=[df4,desc,gameTitle])
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import pandas as pd
|
| 3 |
from home_view.app_theme import SoftBlue
|
| 4 |
+
from utilities import constants
|
| 5 |
from sketch import sketch as sk
|
| 6 |
from slack_processing.slack_data_prep import FetchSlack, ProcessSlack, CreateEmbeddings
|
| 7 |
from create_games.create_games_slack import LoadThemes,GetPlayers,CreateGameForGroup,GetPeopleByThemesDF
|
|
|
|
| 25 |
return startDF, slackDF, embeddingsDF, playersDF, gamesDF
|
| 26 |
|
| 27 |
def Init():
|
|
|
|
| 28 |
global startDF, slackDF, embeddingsDF, gamesDF,players,playersDF,playersValues
|
| 29 |
startDF=FetchSlack()
|
| 30 |
slackDF=ProcessSlack()
|
|
|
|
| 46 |
break
|
| 47 |
|
| 48 |
def PlayGame():
|
|
|
|
|
|
|
| 49 |
return gr.update(visible=True)
|
| 50 |
|
| 51 |
def Predict(sketch):
|
|
|
|
| 55 |
def CreateGame():
|
| 56 |
global players,gameTitle
|
| 57 |
game_ideas = CreateGameForGroup(players)
|
| 58 |
+
#print("CreateGame():", game_ideas)
|
| 59 |
if not game_ideas is None:
|
| 60 |
game_ideas_dict = game_ideas.to_dict('records')
|
| 61 |
return game_ideas, game_ideas_dict[0]['Description'],game_ideas_dict[0]['Name']
|
| 62 |
+
return None, constants.NO_GAME_TITLE, constants.NO_GAME
|
| 63 |
|
| 64 |
df1 =gr.Dataframe(type="pandas", value=startDF)
|
| 65 |
df2 =gr.Dataframe(type="pandas", value=slackDF)
|
|
|
|
| 69 |
|
| 70 |
with gr.Blocks() as ui:
|
| 71 |
with gr.Row():
|
| 72 |
+
logo=gr.Image(value=constants.BUILDPLAY_LOGO, width=200, height=200, show_download_button=False, container=False)
|
| 73 |
+
directions= gr.Markdown(constants.DIRECTIONS, container=False)
|
| 74 |
with gr.Column():
|
| 75 |
+
playersCB = gr.CheckboxGroup ([], label=constants.PLAYERS, info=constants.PLAYERS_INFO )
|
| 76 |
+
createBtn = gr.Button(value=constants.CREATE_GAME, variant="primary")
|
| 77 |
+
gameTitle=gr.Markdown(constants.GAME_TITLE, container=False)
|
| 78 |
+
desc=gr.TextArea(info=constants.GAME_DESC, interactive=False, show_label=False,
|
| 79 |
+
placeholder=constants.GAME_DESC_PLACEHOLDER, lines=3)
|
| 80 |
+
playBtn = gr.Button(value=constants.PLAY_GAME, variant="primary")
|
| 81 |
with gr.Row(visible=False) as holder:
|
| 82 |
sketch=gr.Image(image_mode="L", source="canvas", width=600, height =600, invert_colors=True, interactive=True,
|
| 83 |
+
brush_radius=.5, type="numpy", label="Sketch", show_label=True, show_download_button=False)
|
| 84 |
label=gr.Label()
|
| 85 |
sketch.change(Predict, inputs=[sketch], outputs=[label])
|
| 86 |
|
| 87 |
with gr.Blocks() as dfs:
|
| 88 |
+
fetchBtn=gr.Button(value=constants.FETCH_DATA, variant="primary")
|
| 89 |
+
gr.TabbedInterface([df1,df2,df3,df4,df5], (constants.UI1, constants.UI2, constants.UI3, constants.UI4, constants.UI5), theme=SoftBlue())
|
| 90 |
fetchBtn.click(FetchData, inputs=[], outputs=[df1,df2,df3,df4,df5])
|
| 91 |
playersCB.change(SetSelected, inputs=[playersCB], outputs=[])
|
| 92 |
createBtn.click(CreateGame, inputs=[], outputs=[df4,desc,gameTitle])
|
utilities/__pycache__/constants.cpython-311.pyc
ADDED
|
Binary file (949 Bytes). View file
|
|
|
utilities/constants.py
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#HOME
|
| 2 |
+
DIRECTIONS="Directions: Select players and click Create Game to generate a game customized for the group. Then click Play Game to play the game."
|
| 3 |
+
GAME_DESC="A description and rules for your game will show here. "
|
| 4 |
+
GAME_DESC_PLACEHOLDER="Fun game incoming..."
|
| 5 |
+
PLAYERS="Players"
|
| 6 |
+
PLAYERS_INFO="Pick some players for the game!"
|
| 7 |
+
CREATE_GAME="Create Game"
|
| 8 |
+
GAME_TITLE="Game Title"
|
| 9 |
+
NO_GAME="No game created"
|
| 10 |
+
NO_GAME_TITLE="Game Title: No game created"
|
| 11 |
+
PLAY_GAME="Play Game"
|
| 12 |
+
BUILDPLAY_LOGO="home_view/art/buildPlay.svg"
|
| 13 |
+
FETCH_DATA="Fetch data"
|
| 14 |
+
|
| 15 |
+
UI1="Slack"
|
| 16 |
+
UI2="Themes"
|
| 17 |
+
UI3="Embeddings"
|
| 18 |
+
UI4="Topics by Player"
|
| 19 |
+
UI5="Games"
|