Seanyoon commited on
Commit
5295340
1 Parent(s): 2875cfa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -1,16 +1,15 @@
1
  import gradio as gr
2
- import torch
3
  from semdiffusers import SemanticEditPipeline
4
 
5
- device='cuda'
6
 
7
  pipe = SemanticEditPipeline.from_pretrained(
8
  "runwayml/stable-diffusion-v1-5",
9
  ).to(device)
10
 
11
  def infer(prompt, seed):
12
- gen = torch.Generator(device=device)
13
- gen.manual_seed(seed)
14
 
15
  out = pipe(
16
  prompt=prompt,
 
1
  import gradio as gr
2
+ import tensorflow as tf
3
  from semdiffusers import SemanticEditPipeline
4
 
5
+ device = 'gpu' if tf.config.list_physical_devices('GPU') else 'cpu'
6
 
7
  pipe = SemanticEditPipeline.from_pretrained(
8
  "runwayml/stable-diffusion-v1-5",
9
  ).to(device)
10
 
11
  def infer(prompt, seed):
12
+ gen = tf.random.Generator.from_seed(seed)
 
13
 
14
  out = pipe(
15
  prompt=prompt,