colbyford commited on
Commit
f73076c
1 Parent(s): 2f14da2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -8
app.py CHANGED
@@ -1,13 +1,20 @@
1
  import gradio as gr
2
- from evodiff.pretrained import OA_DM_38M
3
- from evodiff.generate import generate_oaardm
4
 
5
- checkpoint = OA_DM_38M()
6
- model, collater, tokenizer, scheme = checkpoint
7
 
8
 
9
- def make_seq(seq_len):
10
- tokeinzed_sample, generated_sequence = generate_oaardm(model, tokenizer, seq_len, batch_size=1, device='cpu')
 
 
 
 
 
 
 
 
 
11
  return generated_sequence
12
 
13
  # iface = gr.Interface(
@@ -24,7 +31,10 @@ with gr.Blocks() as edapp:
24
  gr.Markdown(
25
  """
26
  # EvoDiff
27
- Created By: Microsoft Research (Sarah Alamdari, Nitya Thakkar, Rianne van den Berg, Alex X. Lu, Nicolo Fusi, ProfileAva P. Amini, and Kevin K. Yang)
 
 
 
28
  Spaces App By: Colby T. Ford
29
  """
30
  )
@@ -36,7 +46,11 @@ with gr.Blocks() as edapp:
36
  """)
37
  gr.Interface(
38
  fn=make_seq,
39
- inputs=gr.Slider(10, 100, label = "Sequence Length"),
 
 
 
 
40
  outputs="text"
41
  )
42
 
 
1
  import gradio as gr
2
+ from evodiff.pretrained import OA_DM_38M, D3PM_UNIFORM_38M
3
+ from evodiff.generate import generate_oaardm, generate_d3pm
4
 
 
 
5
 
6
 
7
+ def make_seq(seq_len, model_type):
8
+ if model_type == "EvoDiff-Seq-OADM 38M":
9
+ checkpoint = OA_DM_38M()
10
+ model, collater, tokenizer, scheme = checkpoint
11
+ tokeinzed_sample, generated_sequence = generate_oaardm(model, tokenizer, seq_len, batch_size=1, device='cpu')
12
+
13
+ if model_type == "EvoDiff-D3PM-Uniform 38M":
14
+ checkpoint = D3PM_UNIFORM_38M(return_all=True)
15
+ model, collater, tokenizer, scheme, timestep, Q_bar, Q = checkpoint
16
+ tokeinzed_sample, generated_sequence = generate_d3pm(model, tokenizer, Q, Q_bar, timestep, seq_len, batch_size=1, device='cpu')
17
+
18
  return generated_sequence
19
 
20
  # iface = gr.Interface(
 
31
  gr.Markdown(
32
  """
33
  # EvoDiff
34
+ ## Generation of protein sequences and evolutionary alignments via discrete diffusion models
35
+
36
+ Created By: Microsoft Research [Sarah Alamdari, Nitya Thakkar, Rianne van den Berg, Alex X. Lu, Nicolo Fusi, ProfileAva P. Amini, and Kevin K. Yang]
37
+
38
  Spaces App By: Colby T. Ford
39
  """
40
  )
 
46
  """)
47
  gr.Interface(
48
  fn=make_seq,
49
+ inputs=[
50
+ gr.Slider(10, 100, label = "Sequence Length")
51
+ gr.Dropdown(["EvoDiff-Seq-OADM 38M", "EvoDiff-D3PM-Uniform 38M"], type="value"),
52
+ gr.()
53
+ ],
54
  outputs="text"
55
  )
56