async def recognize():
    if len([line.strip() for line in open("queue.txt")]) > 0:
        filename = await rofl.async_run_from_queue(ioloop,
                                                   fps_factor=60,
                                                   emotions=True)
        api.upload_video(filename,
                         upload_name=filename.split('/')[-1],
                         folder_id=rofl_folder)
        api.upload_video(filename, upload_name=filename, room_num=room)
        return filename
    else:
        await asyncio.sleep(5)
        return 0
Exemple #2
0
def send_file(filename, link=''):
    r = api.upload_video("video_output/" + filename,
                         filename.split('/')[-1],
                         folder_id=rofl_folder)
    _id = r['id']
    """Show result endpoint."""
    return "https://drive.google.com/file/d/" + _id + "/" + link
Exemple #3
0
    async def message_handler(self, text, message_id):
        if not api.validate(text):
            logging.debug('invalid url received: {0}'.format(text))
            await self.reply(replies.INVALID_URL, message_id)
            return

        await self.reply(replies.UPLOAD_STARTED, message_id)
        video_data = api.download(text, config['tmp_path'])
        video_vk_url = api.upload_video(vk_api, video_data.path,
                                        video_data.name)
        os.remove(video_data.path)

        logging.info("uploaded: {0} -> {1}".format(text, video_vk_url))
        await self.reply(replies.UPLOADED_VIDEO.format(video_vk_url),
                         message_id)
Exemple #4
0
from rofl import ROFL
from recognizer import Recognizer
from encode import encode_cluster_sf
import api

model = "trained_knn_model.clf"
# recog = Recognizer()
# recog.train(n_neighbors=2, model_save_path=model)

# rofl = ROFL(recognizer_path=model, retina=True, on_gpu=True, emotions=True)
filename = "jackle.mp4"
filename1 = "twice.mp4"
api.upload_video("video_output/2020-08-12_08-00_305_54.mp4",
                 upload_name="2020-08-12_08:00_305.mp4",
                 folder_id="1iR8EpBv0jGPwVQ7YepeFPccj4a0jhzPJ")

# rofl.basic_run(".", filename1, fps_factor=30, recognize=True, emotions=True)
# rofl.run_emotions(".", filename1, fps_factor=30)
# rofl.basic_run(".", filename, fps_factor=30)
# rofl.run_and_remember_strangers(filename, fps_factor=30)

# encode_cluster_sf("./strangers", "./enc_cluster.pickle")
# rofl.clust.remember_strangers("enc_cluster.pickle", save_path="known_faces")