martynka commited on
Commit
238feee
·
verified ·
1 Parent(s): 9085f90

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -5,7 +5,7 @@ from PIL import Image
5
  import os
6
  # Load Stable Diffusion model
7
  HF_TOKEN = os.environ.get("HF_TOKEN") if os.environ.get("HF_TOKEN") else None
8
- model = gr.load("models/stabilityai/stable-diffusion-3.5-large", hf_token=HF_TOKEN)
9
 
10
  # Chevereto API details
11
  CHEVERETO_API_URL = os.environ.get("api_url") # Replace with your Chevereto API endpoint
@@ -35,7 +35,7 @@ def upload_to_chevereto(image: Image.Image) -> str:
35
 
36
  # Generate and upload the image
37
  def generate_image_and_upload(prompt: str) -> str:
38
- img = model.predict(prompt)[0] # Get generated image
39
  return upload_to_chevereto(img) # Upload and return the URL
40
 
41
  # Define Gradio API returning the Chevereto public URL
 
5
  import os
6
  # Load Stable Diffusion model
7
  HF_TOKEN = os.environ.get("HF_TOKEN") if os.environ.get("HF_TOKEN") else None
8
+ model = gr.Interface.load("models/stabilityai/stable-diffusion-3.5-large", hf_token=HF_TOKEN)
9
 
10
  # Chevereto API details
11
  CHEVERETO_API_URL = os.environ.get("api_url") # Replace with your Chevereto API endpoint
 
35
 
36
  # Generate and upload the image
37
  def generate_image_and_upload(prompt: str) -> str:
38
+ img = img = model.submit([prompt]) # Get generated image
39
  return upload_to_chevereto(img) # Upload and return the URL
40
 
41
  # Define Gradio API returning the Chevereto public URL