DrishtiSharma commited on
Commit
5f50b04
·
verified ·
1 Parent(s): ccf98cc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -0
app.py CHANGED
@@ -57,6 +57,25 @@ pipe = DiffusionPipeline.from_pretrained(
57
  MAX_SEED = np.iinfo(np.int32).max
58
 
59
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
  class MultiAgentState(BaseModel):
61
  state: List[str] = []
62
  messages: Annotated[list[AnyMessage], add_messages]
 
57
  MAX_SEED = np.iinfo(np.int32).max
58
 
59
 
60
+ def infer(prompt, seed=42, randomize_seed=False, width=1024, height=1024, num_inference_steps=4):
61
+ if randomize_seed:
62
+ seed = random.randint(0, MAX_SEED)
63
+ generator = torch.Generator().manual_seed(seed)
64
+
65
+ image = pipe(
66
+ prompt=prompt,
67
+ width=width,
68
+ height=height,
69
+ num_inference_steps=num_inference_steps,
70
+ generator=generator,
71
+ guidance_scale=0.0
72
+ ).images[0]
73
+
74
+ return image, seed
75
+
76
+
77
+
78
+
79
  class MultiAgentState(BaseModel):
80
  state: List[str] = []
81
  messages: Annotated[list[AnyMessage], add_messages]