wukevin commited on
Commit
2293b93
1 Parent(s): ec31a84

Support for specifying seed

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -1,15 +1,20 @@
1
  import gradio as gr
2
 
 
3
  from foldingdiff import sampling
4
 
5
- def sample_at_length(l:int):
 
6
  l = int(l)
7
  s = sampling.sample_simple("wukevin/foldingdiff_cath", n=1, sweep_lengths=(l, l+1))
8
  return s[0]
9
 
10
  interface = gr.Interface(
11
  fn=sample_at_length,
12
- inputs=gr.Number(value=55, label="Protein backbone length to generate", show_label=True, precision=0),
 
 
 
13
  outputs=gr.Dataframe(),
14
  )
15
  interface.launch()
 
1
  import gradio as gr
2
 
3
+ import torch
4
  from foldingdiff import sampling
5
 
6
+ def sample_at_length(l:int, seed:int):
7
+ torch.manual_seed(seed)
8
  l = int(l)
9
  s = sampling.sample_simple("wukevin/foldingdiff_cath", n=1, sweep_lengths=(l, l+1))
10
  return s[0]
11
 
12
  interface = gr.Interface(
13
  fn=sample_at_length,
14
+ inputs=[
15
+ gr.Number(value=55, label="Protein backbone length to generate", show_label=True, precision=0),
16
+ gr.Number(value=1234, label="Random seed", show_label=True, precision=0),
17
+ ],
18
  outputs=gr.Dataframe(),
19
  )
20
  interface.launch()