vilarin commited on
Commit
a3cc10d
1 Parent(s): 0787d9c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -11
app.py CHANGED
@@ -54,17 +54,18 @@ async def generate_image(
54
  text = str(translator.translate(prompt, 'English')) + "," + lora_word
55
 
56
  client = AsyncInferenceClient()
57
-
58
- image = await client.text_to_image(
59
- prompt=text,
60
- negative_prompt=negative_prompt,
61
- height=height,
62
- width=width,
63
- guidance_scale=scales,
64
- num_inference_steps=steps,
65
- model=model,
66
- )
67
- print(image)
 
68
 
69
  return image, seed
70
 
 
54
  text = str(translator.translate(prompt, 'English')) + "," + lora_word
55
 
56
  client = AsyncInferenceClient()
57
+ try:
58
+ image = await client.text_to_image(
59
+ prompt=text,
60
+ negative_prompt=negative_prompt,
61
+ height=height,
62
+ width=width,
63
+ guidance_scale=scales,
64
+ num_inference_steps=steps,
65
+ model=model,
66
+ )
67
+ except Exception as e:
68
+ raise gr.Error(f"Error in {e}")
69
 
70
  return image, seed
71