martynka commited on
Commit
b622977
·
verified ·
1 Parent(s): f5815bd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -42,11 +42,13 @@ def upload_to_chevereto(image_path: str):
42
  return f"Error uploading image: {response.text}"
43
 
44
  def generate_and_upload(prompt: str):
45
- """Combines image generation + upload and returns Chevereto URL"""
46
  img_path = generate_image(prompt)
47
  if "Error" in img_path:
48
- return img_path
49
- return upload_to_chevereto(img_path)
 
 
50
 
51
  # Gradio UI
52
  with gr.Blocks() as app:
@@ -64,4 +66,4 @@ with gr.Blocks() as app:
64
  outputs=[image_output, url_output]
65
  )
66
 
67
- app.launch(server_port=7860)
 
42
  return f"Error uploading image: {response.text}"
43
 
44
  def generate_and_upload(prompt: str):
45
+ """Combines image generation + upload and returns both the image path and Chevereto URL"""
46
  img_path = generate_image(prompt)
47
  if "Error" in img_path:
48
+ return img_path, "" # Return error message and empty string for URL
49
+
50
+ url = upload_to_chevereto(img_path)
51
+ return img_path, url # Return the image path and the Chevereto URL
52
 
53
  # Gradio UI
54
  with gr.Blocks() as app:
 
66
  outputs=[image_output, url_output]
67
  )
68
 
69
+ app.launch(server_port=7860, share=True)