harmionestark commited on
Commit
cfb0720
Β·
verified Β·
1 Parent(s): c3233df

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -55,8 +55,10 @@ def infer(
55
  negative_prompt = str(negative_prompt) if negative_prompt else ""
56
 
57
  # Ensure text input IDs are of type LongTensor
58
- if hasattr(pipe.text_encoder, 'input_ids'):
59
- pipe.text_encoder.input_ids = pipe.text_encoder.input_ids.to(torch.long)
 
 
60
 
61
  image = pipe(
62
  prompt=prompt,
@@ -170,4 +172,4 @@ with gr.Blocks(css=css) as demo:
170
  )
171
 
172
  if __name__ == "__main__":
173
- demo.launch()
 
55
  negative_prompt = str(negative_prompt) if negative_prompt else ""
56
 
57
  # Ensure text input IDs are of type LongTensor
58
+ if isinstance(prompt, torch.Tensor):
59
+ prompt = prompt.to(torch.long)
60
+ if isinstance(negative_prompt, torch.Tensor):
61
+ negative_prompt = negative_prompt.to(torch.long)
62
 
63
  image = pipe(
64
  prompt=prompt,
 
172
  )
173
 
174
  if __name__ == "__main__":
175
+ demo.launch()