Spaces:
Sleeping
Sleeping
Commit ·
5963935
1
Parent(s): 0d942f2
Update app.py
Browse files
app.py
CHANGED
|
@@ -134,6 +134,7 @@ def reset_textbox():
|
|
| 134 |
return gr.update(value='', interactive=False), gr.update(interactive=False)
|
| 135 |
|
| 136 |
def random_sample():
|
|
|
|
| 137 |
SAMPLE_IDX = random.choices(range(25), k=TOTAL_K)
|
| 138 |
image = np.array(Image.open(os.path.join(os.path.dirname(__file__), "data/Court.jpeg")))
|
| 139 |
random_characters = [Image.open(os.path.join(os.path.dirname(__file__), f'data/characters_{idx:02}.png')).resize((64, 64)) for idx in SAMPLE_IDX]
|
|
@@ -165,7 +166,12 @@ In this app, you can explore the outputs of a gpt-3.5 LLM.
|
|
| 165 |
"""
|
| 166 |
|
| 167 |
def sumbit(image):
|
| 168 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 169 |
|
| 170 |
theme = gr.themes.Default(primary_hue="green")
|
| 171 |
agents = []
|
|
@@ -235,6 +241,8 @@ with gr.Blocks(css = """#col_container { margin-left: auto; margin-right: auto;}
|
|
| 235 |
|
| 236 |
b0.click(random_sample, inputs = [], outputs = [image])
|
| 237 |
b2.click(reset_sample, inputs = [], outputs = [image])
|
|
|
|
|
|
|
| 238 |
|
| 239 |
# inputs.submit(reset_textbox, [], [inputs, b1], queue=False)
|
| 240 |
# inputs.submit(predict, [inputs, top_p, temperature, chat_counter, chatbot, state], [chatbot, state, chat_counter, server_status_code, inputs, b1],) #openai_api_key
|
|
|
|
| 134 |
return gr.update(value='', interactive=False), gr.update(interactive=False)
|
| 135 |
|
| 136 |
def random_sample():
|
| 137 |
+
global SAMPLE_IDX
|
| 138 |
SAMPLE_IDX = random.choices(range(25), k=TOTAL_K)
|
| 139 |
image = np.array(Image.open(os.path.join(os.path.dirname(__file__), "data/Court.jpeg")))
|
| 140 |
random_characters = [Image.open(os.path.join(os.path.dirname(__file__), f'data/characters_{idx:02}.png')).resize((64, 64)) for idx in SAMPLE_IDX]
|
|
|
|
| 166 |
"""
|
| 167 |
|
| 168 |
def sumbit(image):
|
| 169 |
+
global CURRENT_POSITION
|
| 170 |
+
balloon = Image.open(os.path.join(os.path.dirname(__file__), 'data/balloon.png')).resize((64, 64))
|
| 171 |
+
new_image = Image.fromarray(image).convert('RGBA')
|
| 172 |
+
for k in range(TOTAL_K):
|
| 173 |
+
new_image.paste(balloon, [CURRENT_POSITION[k][0], CURRENT_POSITION[k][1] + 64], balloon)
|
| 174 |
+
return np.array(new_image)
|
| 175 |
|
| 176 |
theme = gr.themes.Default(primary_hue="green")
|
| 177 |
agents = []
|
|
|
|
| 241 |
|
| 242 |
b0.click(random_sample, inputs = [], outputs = [image])
|
| 243 |
b2.click(reset_sample, inputs = [], outputs = [image])
|
| 244 |
+
|
| 245 |
+
b1.click(submin, inputs = [image], outputs = [image])
|
| 246 |
|
| 247 |
# inputs.submit(reset_textbox, [], [inputs, b1], queue=False)
|
| 248 |
# inputs.submit(predict, [inputs, top_p, temperature, chat_counter, chatbot, state], [chatbot, state, chat_counter, server_status_code, inputs, b1],) #openai_api_key
|