svjack commited on
Commit
d185329
·
verified ·
1 Parent(s): 20f9ac2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -1,12 +1,14 @@
1
  # Import necessary libraries
2
  import gradio as gr
3
- import transformers_js_py
 
4
 
5
  # Define the function to generate an image from text using the Liberata/illustrious-xl-v1.0 model
6
  def generate_image(prompt, guidance_scale, num_inference_steps):
7
  # Load the model from the specified file
8
- model = transformers_js_py.StableDiffusionXLPipeline.from_pretrained(
9
- "https://huggingface.co/Liberata/illustrious-xl-v1.0/resolve/main/Illustrious-XL-v1.0.safetensors"
 
10
  )
11
  # Generate the image from the text prompt with the specified parameters
12
  image = model(prompt, guidance_scale=guidance_scale, num_inference_steps=num_inference_steps).images[0]
 
1
  # Import necessary libraries
2
  import gradio as gr
3
+ import diffusers
4
+ import torch
5
 
6
  # Define the function to generate an image from text using the Liberata/illustrious-xl-v1.0 model
7
  def generate_image(prompt, guidance_scale, num_inference_steps):
8
  # Load the model from the specified file
9
+ model = diffusers.StableDiffusionXLPipeline.from_pretrained(
10
+ "Liberata/illustrious-xl-v1.0",
11
+ torch_dtype=torch.float16
12
  )
13
  # Generate the image from the text prompt with the specified parameters
14
  image = model(prompt, guidance_scale=guidance_scale, num_inference_steps=num_inference_steps).images[0]