Philipp Allgeuer
commited on
Commit
·
1b36964
1
Parent(s):
24fb2c3
Test whether can git pull NOVIC code
Browse files
app.py
CHANGED
|
@@ -5,10 +5,20 @@
|
|
| 5 |
import os
|
| 6 |
import glob
|
| 7 |
import random
|
|
|
|
|
|
|
| 8 |
from typing import Optional
|
| 9 |
import PIL.Image
|
| 10 |
import gradio as gr
|
| 11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
# Sample images
|
| 13 |
IMAGE_EXTS = ('jpg', 'jpeg', 'png', 'webp')
|
| 14 |
SAMPLE_IMAGES = sorted(image_path for image_ext in IMAGE_EXTS for image_path in glob.glob(os.path.join('sample_images', f'*.{image_ext}')))
|
|
|
|
| 5 |
import os
|
| 6 |
import glob
|
| 7 |
import random
|
| 8 |
+
import pathlib
|
| 9 |
+
import subprocess
|
| 10 |
from typing import Optional
|
| 11 |
import PIL.Image
|
| 12 |
import gradio as gr
|
| 13 |
|
| 14 |
+
# Ensure access to NOVIC code
|
| 15 |
+
REPO_ROOT = pathlib.Path(__file__).parent.resolve()
|
| 16 |
+
SENTINEL = REPO_ROOT / '.submodules_done'
|
| 17 |
+
if not SENTINEL.exists():
|
| 18 |
+
print("Initialising git submodules...")
|
| 19 |
+
subprocess.run(['git', 'submodule', 'update', '--init', '--recursive'], cwd=REPO_ROOT, check=True)
|
| 20 |
+
SENTINEL.touch()
|
| 21 |
+
|
| 22 |
# Sample images
|
| 23 |
IMAGE_EXTS = ('jpg', 'jpeg', 'png', 'webp')
|
| 24 |
SAMPLE_IMAGES = sorted(image_path for image_ext in IMAGE_EXTS for image_path in glob.glob(os.path.join('sample_images', f'*.{image_ext}')))
|