13ze commited on
Commit
efba06b
·
verified ·
1 Parent(s): aef8ef1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -7,11 +7,18 @@ if not os.path.exists('imagens'):
7
  os.makedirs('imagens')
8
 
9
  def save_image(image_path):
 
 
 
 
10
  image_name = os.path.basename(image_path)
11
  target_path = os.path.join('imagens', image_name)
12
  shutil.move(image_path, target_path)
13
  url = f"https://13ze-cs.hf.space/file/13ze-cs/imagens/{image_name}"
14
- return target_path, url
 
 
 
15
 
16
  # Interface Gradio
17
  with gr.Blocks() as demo:
 
7
  os.makedirs('imagens')
8
 
9
  def save_image(image_path):
10
+ # Verifica se o caminho é uma lista (às vezes o Gradio retorna uma lista)
11
+ if isinstance(image_path, list):
12
+ image_path = image_path[0]
13
+
14
  image_name = os.path.basename(image_path)
15
  target_path = os.path.join('imagens', image_name)
16
  shutil.move(image_path, target_path)
17
  url = f"https://13ze-cs.hf.space/file/13ze-cs/imagens/{image_name}"
18
+ return target_path, url, target_path
19
+
20
+ def display_image(image_path):
21
+ return image_path
22
 
23
  # Interface Gradio
24
  with gr.Blocks() as demo: