Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
import cv2 as cv
|
2 |
import numpy as np
|
3 |
import gradio as gr
|
4 |
-
import datetime
|
5 |
from pathlib import Path
|
6 |
from huggingface_hub import hf_hub_download
|
7 |
|
@@ -64,6 +63,7 @@ else:
|
|
64 |
example_paths = []
|
65 |
|
66 |
example_list = [[p] for p in example_paths]
|
|
|
67 |
# =============================================================
|
68 |
|
69 |
# Gradio Interface
|
@@ -89,10 +89,12 @@ with gr.Blocks(css='''.example * { font-style: italic; font-size: 18px !importan
|
|
89 |
gr.Markdown("Klik op een voorbeeld om het te proberen.", elem_classes=["example"])
|
90 |
|
91 |
gr.Examples(
|
92 |
-
examples=example_list,
|
93 |
inputs=input_image,
|
94 |
-
|
95 |
-
|
|
|
|
|
96 |
)
|
97 |
|
98 |
if __name__ == "__main__":
|
|
|
1 |
import cv2 as cv
|
2 |
import numpy as np
|
3 |
import gradio as gr
|
|
|
4 |
from pathlib import Path
|
5 |
from huggingface_hub import hf_hub_download
|
6 |
|
|
|
63 |
example_paths = []
|
64 |
|
65 |
example_list = [[p] for p in example_paths]
|
66 |
+
CACHE_EXAMPLES = bool(example_list) # cache alleen als er echt voorbeelden zijn
|
67 |
# =============================================================
|
68 |
|
69 |
# Gradio Interface
|
|
|
89 |
gr.Markdown("Klik op een voorbeeld om het te proberen.", elem_classes=["example"])
|
90 |
|
91 |
gr.Examples(
|
92 |
+
examples=example_list, # automatisch ingelezen paden
|
93 |
inputs=input_image,
|
94 |
+
outputs=output_image, # <-- nodig voor cache
|
95 |
+
fn=detect_expression, # <-- nodig voor cache
|
96 |
+
examples_per_page=20,
|
97 |
+
cache_examples=CACHE_EXAMPLES # True alleen als er voorbeelden zijn
|
98 |
)
|
99 |
|
100 |
if __name__ == "__main__":
|