Merge pull request #10214 from AUTOMATIC1111/refresh-fix

Refresh fix
This commit is contained in:
AUTOMATIC1111 2023-05-09 15:29:48 +03:00 committed by GitHub
commit 8fb16ceb28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,7 +2,6 @@ import os
import tempfile import tempfile
from collections import namedtuple from collections import namedtuple
from pathlib import Path from pathlib import Path
from time import time
import gradio as gr import gradio as gr
@ -35,11 +34,9 @@ def check_tmp_file(gradio, filename):
def save_pil_to_file(pil_image, dir=None): def save_pil_to_file(pil_image, dir=None):
already_saved_as = getattr(pil_image, 'already_saved_as', None) already_saved_as = getattr(pil_image, 'already_saved_as', None)
if already_saved_as and os.path.isfile(already_saved_as): if already_saved_as and os.path.isfile(already_saved_as):
already_saved_as += f'?{os.path.getmtime(already_saved_as)}'
register_tmp_file(shared.demo, already_saved_as) register_tmp_file(shared.demo, already_saved_as)
file_obj = Savedfile(already_saved_as) file_obj = Savedfile(f'{already_saved_as}?{os.path.getmtime(already_saved_as)}')
return file_obj return file_obj
if shared.opts.temp_dir != "": if shared.opts.temp_dir != "":