Spaces:
Paused
Paused
tmzh
commited on
Commit
·
4e357cc
1
Parent(s):
77b6f68
display explanations
Browse files
app.py
CHANGED
@@ -115,7 +115,7 @@ def group_words(words):
|
|
115 |
print("Grouping words:", words)
|
116 |
|
117 |
print("Got groupings: ", json.dumps(response, indent=4))
|
118 |
-
return
|
119 |
|
120 |
|
121 |
def generate_clues(group):
|
@@ -154,7 +154,6 @@ def generate_clues(group):
|
|
154 |
|
155 |
|
156 |
def process_image(img):
|
157 |
-
print(img, type(img))
|
158 |
raw_response = model.generate_content(['Identify the words in this game of Codenames. Provide only a list of '
|
159 |
'words. Provide the words in capital letters only. Group these words into '
|
160 |
'6 or 8 groups that can be guessed together using a single word clue in '
|
@@ -204,10 +203,10 @@ with gr.Blocks() as demo:
|
|
204 |
|
205 |
|
206 |
def group_words_callback(words):
|
207 |
-
|
208 |
-
|
209 |
-
print("Got groups: ",
|
210 |
-
return [gr.update(value=
|
211 |
|
212 |
|
213 |
def generate_clues_callback(group):
|
|
|
115 |
print("Grouping words:", words)
|
116 |
|
117 |
print("Got groupings: ", json.dumps(response, indent=4))
|
118 |
+
return response
|
119 |
|
120 |
|
121 |
def generate_clues(group):
|
|
|
154 |
|
155 |
|
156 |
def process_image(img):
|
|
|
157 |
raw_response = model.generate_content(['Identify the words in this game of Codenames. Provide only a list of '
|
158 |
'words. Provide the words in capital letters only. Group these words into '
|
159 |
'6 or 8 groups that can be guessed together using a single word clue in '
|
|
|
203 |
|
204 |
|
205 |
def group_words_callback(words):
|
206 |
+
groups = group_words(words)
|
207 |
+
groups = pad_or_truncate(groups, 4)
|
208 |
+
print("Got groups: ", groups, type(groups))
|
209 |
+
return [gr.update(value=groups[i]["words"], choices=words, info=groups[i]["explanation"]) for i in range(4)]
|
210 |
|
211 |
|
212 |
def generate_clues_callback(group):
|