Spaces:
Running
Running
Commit
·
f99c6e0
1
Parent(s):
d6e020b
added demo at start
Browse files
app.py
CHANGED
|
@@ -24,6 +24,9 @@ real_remote = [f for f in all_files if f.startswith("Real/")]
|
|
| 24 |
ai_files = [hf_hub_download(repo_id=REPO_ID, repo_type="dataset",filename=path, token=HF_TOKEN) for path in ai_remote]
|
| 25 |
real_files = [hf_hub_download(repo_id=REPO_ID, repo_type="dataset",filename=path, token=HF_TOKEN) for path in real_remote]
|
| 26 |
|
|
|
|
|
|
|
|
|
|
| 27 |
history_file = "history_state.json"
|
| 28 |
# --------------------------------
|
| 29 |
|
|
@@ -157,6 +160,15 @@ with gr.Blocks(fill_width=True) as demo:
|
|
| 157 |
)
|
| 158 |
state = gr.State(None)
|
| 159 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 160 |
# Add a Start button that WILL load images and start the timer
|
| 161 |
start_btn = gr.Button("Start")
|
| 162 |
|
|
@@ -205,6 +217,11 @@ with gr.Blocks(fill_width=True) as demo:
|
|
| 205 |
inputs=[],
|
| 206 |
outputs=[grid_ui]
|
| 207 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 208 |
|
| 209 |
|
| 210 |
# Reveal main UI only after agreeing to terms
|
|
|
|
| 24 |
ai_files = [hf_hub_download(repo_id=REPO_ID, repo_type="dataset",filename=path, token=HF_TOKEN) for path in ai_remote]
|
| 25 |
real_files = [hf_hub_download(repo_id=REPO_ID, repo_type="dataset",filename=path, token=HF_TOKEN) for path in real_remote]
|
| 26 |
|
| 27 |
+
# Load a sample real image for the demo
|
| 28 |
+
real_demo_path= hf_hub_download(repo_id=REPO_ID, repo_type="dataset",filename="Experiment_grid_3x3.png", token=HF_TOKEN)
|
| 29 |
+
real_demo = np.array(Image.open(real_demo_path).convert("RGB"))
|
| 30 |
history_file = "history_state.json"
|
| 31 |
# --------------------------------
|
| 32 |
|
|
|
|
| 160 |
)
|
| 161 |
state = gr.State(None)
|
| 162 |
|
| 163 |
+
example_ui = gr.Column(visible=True)
|
| 164 |
+
with example_ui:
|
| 165 |
+
gr.Markdown("### Before you begin: This are what *Real* Images look like. Click start to begin the game. ")
|
| 166 |
+
gr.Image(value=real_demo, type="numpy", show_label=False).style(
|
| 167 |
+
width=300, # px
|
| 168 |
+
height=300 # px
|
| 169 |
+
) # set desired display height)
|
| 170 |
+
gr.Markdown("---")
|
| 171 |
+
|
| 172 |
# Add a Start button that WILL load images and start the timer
|
| 173 |
start_btn = gr.Button("Start")
|
| 174 |
|
|
|
|
| 217 |
inputs=[],
|
| 218 |
outputs=[grid_ui]
|
| 219 |
)
|
| 220 |
+
start_btn.click(
|
| 221 |
+
fn=lambda _: gr.update(visible=False),
|
| 222 |
+
inputs=[],
|
| 223 |
+
outputs=[example_ui]
|
| 224 |
+
)
|
| 225 |
|
| 226 |
|
| 227 |
# Reveal main UI only after agreeing to terms
|