(_: gr.Blocks, app: FastAPI, controller)
| 106 | return None |
| 107 | |
| 108 | def infer_forward_api(_: gr.Blocks, app: FastAPI, controller): |
| 109 | @app.post("/videox_fun/infer_forward") |
| 110 | def _infer_forward_api( |
| 111 | datas: dict, |
| 112 | ): |
| 113 | base_model_path = datas.get('base_model_path', 'none') |
| 114 | lora_model_path = datas.get('lora_model_path', 'none') |
| 115 | lora_alpha_slider = datas.get('lora_alpha_slider', 0.55) |
| 116 | prompt_textbox = datas.get('prompt_textbox', None) |
| 117 | negative_prompt_textbox = datas.get('negative_prompt_textbox', 'The video is not of a high quality, it has a low resolution. Watermark present in each frame. The background is solid. Strange body and strange trajectory. Distortion. ') |
| 118 | sampler_dropdown = datas.get('sampler_dropdown', 'Euler') |
| 119 | sample_step_slider = datas.get('sample_step_slider', 30) |
| 120 | resize_method = datas.get('resize_method', "Generate by") |
| 121 | width_slider = datas.get('width_slider', 672) |
| 122 | height_slider = datas.get('height_slider', 384) |
| 123 | base_resolution = datas.get('base_resolution', 512) |
| 124 | is_image = datas.get('is_image', False) |
| 125 | generation_method = datas.get('generation_method', False) |
| 126 | length_slider = datas.get('length_slider', 49) |
| 127 | overlap_video_length = datas.get('overlap_video_length', 4) |
| 128 | partial_video_length = datas.get('partial_video_length', 72) |
| 129 | cfg_scale_slider = datas.get('cfg_scale_slider', 6) |
| 130 | start_image = datas.get('start_image', None) |
| 131 | end_image = datas.get('end_image', None) |
| 132 | validation_video = datas.get('validation_video', None) |
| 133 | validation_video_mask = datas.get('validation_video_mask', None) |
| 134 | control_video = datas.get('control_video', None) |
| 135 | denoise_strength = datas.get('denoise_strength', 0.70) |
| 136 | seed_textbox = datas.get("seed_textbox", 43) |
| 137 | |
| 138 | generation_method = "Image Generation" if is_image else generation_method |
| 139 | |
| 140 | if start_image is not None: |
| 141 | if start_image.startswith('http'): |
| 142 | start_image = save_url_image(start_image) |
| 143 | start_image = [Image.open(start_image)] |
| 144 | else: |
| 145 | start_image = base64.b64decode(start_image) |
| 146 | start_image = [Image.open(BytesIO(start_image))] |
| 147 | |
| 148 | if end_image is not None: |
| 149 | if end_image.startswith('http'): |
| 150 | end_image = save_url_image(end_image) |
| 151 | end_image = [Image.open(end_image)] |
| 152 | else: |
| 153 | end_image = base64.b64decode(end_image) |
| 154 | end_image = [Image.open(BytesIO(end_image))] |
| 155 | |
| 156 | if validation_video is not None: |
| 157 | if validation_video.startswith('http'): |
| 158 | validation_video = save_url_video(validation_video) |
| 159 | else: |
| 160 | validation_video = save_base64_video(validation_video) |
| 161 | |
| 162 | if validation_video_mask is not None: |
| 163 | if validation_video_mask.startswith('http'): |
| 164 | validation_video_mask = save_url_image(validation_video_mask) |
| 165 | else: |
nothing calls this directly
no outgoing calls
no test coverage detected