Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,15 +9,12 @@ model_id = "stable-diffusion-v1-4"
|
|
| 9 |
translator = pipeline("translation", model="Helsinki-NLP/opus-mt-zh-en")
|
| 10 |
pipe = StableDiffusionPipeline.from_pretrained(
|
| 11 |
model_id,
|
| 12 |
-
revision="fp16",
|
| 13 |
-
torch_dtype=torch.float16,
|
| 14 |
use_auth_token=True,
|
| 15 |
).to(device)
|
| 16 |
|
| 17 |
def stablediffusion(prompt,negative_prompt,H,W,steps,guidance_scale):
|
| 18 |
prompt = translator(prompt)[0]["translation_text"]
|
| 19 |
-
|
| 20 |
-
image = pipe(prompt, num_inference_steps=steps, guidance_scale=guidance_scale,height=H,width=W,negative_prompt=negative_prompt).images[0]
|
| 21 |
|
| 22 |
return image
|
| 23 |
|
|
|
|
| 9 |
translator = pipeline("translation", model="Helsinki-NLP/opus-mt-zh-en")
|
| 10 |
pipe = StableDiffusionPipeline.from_pretrained(
|
| 11 |
model_id,
|
|
|
|
|
|
|
| 12 |
use_auth_token=True,
|
| 13 |
).to(device)
|
| 14 |
|
| 15 |
def stablediffusion(prompt,negative_prompt,H,W,steps,guidance_scale):
|
| 16 |
prompt = translator(prompt)[0]["translation_text"]
|
| 17 |
+
image = pipe(prompt, num_inference_steps=steps, guidance_scale=guidance_scale,height=H,width=W,negative_prompt=negative_prompt).images[0]
|
|
|
|
| 18 |
|
| 19 |
return image
|
| 20 |
|