Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,9 +8,18 @@ import os
|
|
| 8 |
import requests
|
| 9 |
from tempfile import NamedTemporaryFile
|
| 10 |
|
| 11 |
-
|
|
|
|
|
|
|
|
|
|
| 12 |
movenet_model_path = '/models/movenet/movenet_lightning'
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
# Load BLIP model
|
| 16 |
blip_model = BlipForConditionalGeneration.from_pretrained('Salesforce/blip-image-captioning-large')
|
|
|
|
| 8 |
import requests
|
| 9 |
from tempfile import NamedTemporaryFile
|
| 10 |
|
| 11 |
+
|
| 12 |
+
import tensorflow_hub as hub
|
| 13 |
+
|
| 14 |
+
|
| 15 |
movenet_model_path = '/models/movenet/movenet_lightning'
|
| 16 |
+
|
| 17 |
+
# Check if the model path exists
|
| 18 |
+
if not os.path.exists(movenet_model_path):
|
| 19 |
+
# Download the model from TensorFlow Hub
|
| 20 |
+
movenet_model = hub.load("https://tfhub.dev/google/movenet/singlepose/lightning/4")
|
| 21 |
+
else:
|
| 22 |
+
movenet_model = tf.saved_model.load(movenet_model_path)
|
| 23 |
|
| 24 |
# Load BLIP model
|
| 25 |
blip_model = BlipForConditionalGeneration.from_pretrained('Salesforce/blip-image-captioning-large')
|