ahmedfaiyaz commited on
Commit
3c61aac
·
verified ·
1 Parent(s): 2927ac6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -449,14 +449,14 @@ def generate(modelname:str,input_text:str,batch_size:int,inference_steps:int):
449
  inference_steps=int(inference_steps)
450
  print(f"Generating image with label:{character_mappings_model_wise[current_model][input_text]} batch size:{batch_size}")
451
  label=int(character_mappings_model_wise[current_model][input_text])
452
- pipeline.embedding=torch.tensor([label])
453
  generate_image=pipeline(batch_size=batch_size,num_inference_steps=inference_steps).images
454
  return generate_image
455
 
456
 
457
  def switch_pipeline(modelname:str):
458
  global pipeline
459
- pipeline = DiffusionPipeline.from_pretrained(modelname,custom_pipeline="ahmedfaiyaz/OkkhorDiffusion",embedding=torch.float16)
460
  global current_model
461
  current_model=modelname
462
  return f"""
 
449
  inference_steps=int(inference_steps)
450
  print(f"Generating image with label:{character_mappings_model_wise[current_model][input_text]} batch size:{batch_size}")
451
  label=int(character_mappings_model_wise[current_model][input_text])
452
+ pipeline.embedding=torch.tensor([label],device="cpu") #running on free tier
453
  generate_image=pipeline(batch_size=batch_size,num_inference_steps=inference_steps).images
454
  return generate_image
455
 
456
 
457
  def switch_pipeline(modelname:str):
458
  global pipeline
459
+ pipeline = DiffusionPipeline.from_pretrained(modelname,custom_pipeline="ahmedfaiyaz/OkkhorDiffusion",embedding=torch.int16)
460
  global current_model
461
  current_model=modelname
462
  return f"""