Skip to content

Commit

Permalink
add deforum_sys_extend to deforum api setup
Browse files Browse the repository at this point in the history
fixes #833
  • Loading branch information
kabachuha committed Aug 16, 2023
1 parent 083fc8d commit 9c30e95
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion scripts/deforum_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from typing import Any, Dict, List
from deforum_api_models import Batch, DeforumJobErrorType, DeforumJobStatusCategory, DeforumJobPhase, DeforumJobStatus
from contextlib import contextmanager

from deforum_extend_paths import deforum_sys_extend

import gradio as gr
from deforum_helpers.args import (DeforumAnimArgs, DeforumArgs,
Expand Down Expand Up @@ -125,6 +125,8 @@ def run_deforum_batch(batch_id: str, job_ids: [str], deforum_settings_files: Lis
#
def deforum_api(_: gr.Blocks, app: FastAPI):

deforum_sys_extend()

apiState = ApiState()

# Submit a new batch
Expand Down Expand Up @@ -404,6 +406,7 @@ def get(self, job_id:str):
return self.statuses[job_id] if job_id in self.statuses else None

def deforum_init_batch(_: gr.Blocks, app: FastAPI):
deforum_sys_extend()
settings_files = [open(filename, 'r') for filename in cmd_opts.deforum_run_now.split(",")]
[batch_id, job_ids] = make_ids(len(settings_files))
log.info(f"Starting init batch {batch_id} with job(s) {job_ids}...")
Expand All @@ -416,6 +419,7 @@ def deforum_init_batch(_: gr.Blocks, app: FastAPI):

# A simplified, but safe version of Deforum's API
def deforum_simple_api(_: gr.Blocks, app: FastAPI):
deforum_sys_extend()
from fastapi.exceptions import RequestValidationError
from fastapi.responses import JSONResponse
from fastapi import FastAPI, Query, Request, UploadFile
Expand Down

0 comments on commit 9c30e95

Please sign in to comment.