tmzh commited on
Commit
77b6f68
1 Parent(s): 8487b92

add README

Browse files
Files changed (2) hide show
  1. README.md +7 -1
  2. app.py +5 -8
README.md CHANGED
@@ -10,4 +10,10 @@ pinned: false
10
  license: mit
11
  ---
12
 
13
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
10
  license: mit
11
  ---
12
 
13
+ Codenames is a word association game where two teams guess secret words based on one-word clues. The game involves a 25-word grid, with each team identifying their words while avoiding the opposing team's words and the "assassin" word. This space uses Google's `gemini-1.5-flash` model to analyze the game board, provide relevant clues, and assist players in making informed guesses. I was largely successful in getting this to work along with few surprises and learnings along the way.
14
+
15
+
16
+ ## Requirements
17
+
18
+ export GOOGLE_API_KEY=<YOUR_GOOGLE_API_KEY>
19
+
app.py CHANGED
@@ -102,8 +102,8 @@ def group_words(words):
102
  '''
103
 
104
  grouping_system_prompt = ("You are an assistant for the game Codenames. Your task is to help players by grouping a "
105
- "given group of secrets into 3 to 4 groups. Each group should consist of secrets that "
106
- "share a common theme or other word connections such as homonym, hypernyms or synonyms")
107
 
108
  prompt = render_jinja2_template(template, grouping_system_prompt, example_groupings, words)
109
  # print(prompt)
@@ -138,7 +138,7 @@ def generate_clues(group):
138
  '''
139
 
140
  clue_system_prompt = ("You are a codenames game companion. Your task is to give a single word clue related to "
141
- "a given group of words. You will only respond with a single word clue.")
142
 
143
  prompt = render_jinja2_template(template, clue_system_prompt, example_clues, group)
144
 
@@ -172,11 +172,8 @@ with gr.Blocks() as demo:
172
 
173
  with gr.Row():
174
  game_image = gr.Image(type="pil")
175
- word_list_input = gr.Dropdown(label="Enter list of words (comma separated)",
176
- choices='WEREWOLF, CHAIN, MOSQUITO, CRAFT, RANCH, LIP, VALENTINE, CLOUD, '
177
- 'BEARD, BUNK, SECOND, SADDLE, BUCKET, JAIL, ANT, POCKET, LACE, '
178
- 'BREAK, CUCKOO, FLAT, NIL, TIN, CHERRY, CHRISTMAS, MOSES, '
179
- 'TEAM'.split(', '),
180
  multiselect=True,
181
  interactive=True)
182
 
 
102
  '''
103
 
104
  grouping_system_prompt = ("You are an assistant for the game Codenames. Your task is to help players by grouping a "
105
+ "given group of secrets into 3 to 4 groups of 2 to 4 words. Each group should consist of secrets that "
106
+ "share a common theme or other word connections such as homonym, hypernyms or synonyms. Avoid clues that are not too generic or not unique enough to be guessed easily")
107
 
108
  prompt = render_jinja2_template(template, grouping_system_prompt, example_groupings, words)
109
  # print(prompt)
 
138
  '''
139
 
140
  clue_system_prompt = ("You are a codenames game companion. Your task is to give a single word clue related to "
141
+ "a given group of words. You will only respond with a single word clue. The clue can be a common theme or other word connections such as homonym, hypernyms or synonyms. Avoid clues that are not too generic or not unique enough to be guessed easily")
142
 
143
  prompt = render_jinja2_template(template, clue_system_prompt, example_clues, group)
144
 
 
172
 
173
  with gr.Row():
174
  game_image = gr.Image(type="pil")
175
+ word_list_input = gr.Dropdown(label="Detected words",
176
+ choices=[],
 
 
 
177
  multiselect=True,
178
  interactive=True)
179