Update app.py
Browse files
app.py
CHANGED
@@ -97,7 +97,7 @@ MAX_SEED = 1000000
|
|
97 |
MAX_PIXEL_BUDGET = 1024 * 1024
|
98 |
|
99 |
|
100 |
-
|
101 |
def process_input(input_image, upscale_factor):
|
102 |
w, h = input_image.size
|
103 |
aspect_ratio = w / h
|
@@ -121,7 +121,7 @@ def process_input(input_image, upscale_factor):
|
|
121 |
|
122 |
return input_image.resize((w, h)), was_resized
|
123 |
|
124 |
-
|
125 |
def run_inference(process_id, input_image, upscale_factor, seed, num_inference_steps, controlnet_conditioning_scale):
|
126 |
logger.info("Processing inference for process_id: %s", process_id)
|
127 |
input_image, was_resized = process_input(input_image, upscale_factor)
|
@@ -216,10 +216,10 @@ def infer():
|
|
216 |
|
217 |
|
218 |
# Modify status endpoint to receive process_id in request body
|
219 |
-
@app.route('/status', methods=['
|
220 |
def status():
|
221 |
-
|
222 |
-
process_id =
|
223 |
|
224 |
# Check if process_id was provided
|
225 |
if not process_id:
|
|
|
97 |
MAX_PIXEL_BUDGET = 1024 * 1024
|
98 |
|
99 |
|
100 |
+
@spaces.GPU
|
101 |
def process_input(input_image, upscale_factor):
|
102 |
w, h = input_image.size
|
103 |
aspect_ratio = w / h
|
|
|
121 |
|
122 |
return input_image.resize((w, h)), was_resized
|
123 |
|
124 |
+
@spaces.GPU
|
125 |
def run_inference(process_id, input_image, upscale_factor, seed, num_inference_steps, controlnet_conditioning_scale):
|
126 |
logger.info("Processing inference for process_id: %s", process_id)
|
127 |
input_image, was_resized = process_input(input_image, upscale_factor)
|
|
|
216 |
|
217 |
|
218 |
# Modify status endpoint to receive process_id in request body
|
219 |
+
@app.route('/status', methods=['GET'])
|
220 |
def status():
|
221 |
+
# Get the process_id from the query parameters
|
222 |
+
process_id = request.args.get('process_id')
|
223 |
|
224 |
# Check if process_id was provided
|
225 |
if not process_id:
|