Skip to content

Commit

Permalink
Fix conda environment setup and update function name
Browse files Browse the repository at this point in the history
  • Loading branch information
atomashevic committed Dec 7, 2023
1 parent fc94d57 commit 2cd3f6d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions R/image_scores.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@


image_scores <- function(image_file, classes, face_selection = "largest"){
#
# check if active condaenv is transforEmotion
if(grepl("transforEmotion", reticulate::py_config()$python) == FALSE){
if (!(reticulate::condaenv_exists("transforEmotion"))){
print("Creating and switching to transforEmotion virtual Python environment...")
Sys.sleep(1)
setup_miniconda()
} else
{
reticulate::use_condaenv("transforEmotion", required = FALSE)
}
# check if transformer library can be loadedd into conda env
if (!reticulate::py_module_available("transformers") &!reticulate::py_module_available("face_recognition")){
print("Some Python libraries are not available in the transforEmotion conda environment. We are going to set them up. We need them for facial recognition and emotion detection in text, images and video. This may take a while, please be patient.")
Sys.sleep(1)
Expand Down
3 changes: 2 additions & 1 deletion inst/python/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@
import time
import shutil


def yt_analyze(url, nframes, labels, probability=True, side='largest', cut = 'no', start = 0, end=60, uniform = False, ff = 10, save_video = False, save_frames = False, frame_dir = 'temp/', video_name = 'temp'):
text_embeds_openai = get_text_embeds_openai(labels)
text_embeds_openai = get_text_embeds(labels)
start_time = time.time()
temp_dir = frame_dir
if not os.path.exists(temp_dir):
Expand Down

0 comments on commit 2cd3f6d

Please sign in to comment.