Use a new way to solve webpage refresh
This commit is contained in:
parent
5c66fedb64
commit
91a15dca80
@ -2,6 +2,7 @@ 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
|
||||||
|
|
||||||
@ -34,7 +35,7 @@ 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):
|
||||||
register_tmp_file(shared.demo, already_saved_as)
|
register_tmp_file(shared.demo, f'{already_saved_as}?{int(time())}')
|
||||||
|
|
||||||
file_obj = Savedfile(already_saved_as)
|
file_obj = Savedfile(already_saved_as)
|
||||||
return file_obj
|
return file_obj
|
||||||
|
Loading…
Reference in New Issue
Block a user