matanninio commited on
Commit
f98cc68
1 Parent(s): 19dfa7a

save snapshot

Browse files
Files changed (2) hide show
  1. app.py +18 -3
  2. mammal_demo/ppi_task.py +1 -1
app.py CHANGED
@@ -3,32 +3,47 @@ import gradio as gr
3
  from mammal_demo.demo_framework import MammalObjectBroker, MammalTask
4
  from mammal_demo.dti_task import DtiTask
5
  from mammal_demo.ppi_task import PpiTask
 
6
 
7
  all_tasks: dict[str, MammalTask] = dict()
8
  all_models: dict[str, MammalObjectBroker] = dict()
9
 
 
 
 
 
10
  ppi_task = PpiTask(model_dict=all_models)
11
  all_tasks[ppi_task.name] = ppi_task
12
 
13
  tdi_task = DtiTask(model_dict=all_models)
14
  all_tasks[tdi_task.name] = tdi_task
15
 
 
 
 
 
 
 
16
  ppi_model = MammalObjectBroker(
17
- model_path="ibm/biomed.omics.bl.sm.ma-ted-458m", task_list=[ppi_task.name]
18
  )
19
  all_models[ppi_model.name] = ppi_model
20
 
21
  tdi_model = MammalObjectBroker(
22
  model_path="ibm/biomed.omics.bl.sm.ma-ted-458m.dti_bindingdb_pkd",
23
- task_list=[tdi_task.name],
24
  )
25
  all_models[tdi_model.name] = tdi_model
26
 
 
 
 
 
 
27
 
28
  def create_application():
29
  def task_change(value):
30
  visibility = [gr.update(visible=(task == value)) for task in all_tasks.keys()]
31
- # all_tasks[task].demo().visible =
32
  choices = [
33
  model_name
34
  for model_name, model in all_models.items()
 
3
  from mammal_demo.demo_framework import MammalObjectBroker, MammalTask
4
  from mammal_demo.dti_task import DtiTask
5
  from mammal_demo.ppi_task import PpiTask
6
+ from mammal_demo.tcr_task import TcrTask
7
 
8
  all_tasks: dict[str, MammalTask] = dict()
9
  all_models: dict[str, MammalObjectBroker] = dict()
10
 
11
+
12
+ # first create the required tasks
13
+ # Note that the tasks need access to the models, as the model to use depends on the state of the widget
14
+ # we pass the all_models dict and update it when we actualy have the models.
15
  ppi_task = PpiTask(model_dict=all_models)
16
  all_tasks[ppi_task.name] = ppi_task
17
 
18
  tdi_task = DtiTask(model_dict=all_models)
19
  all_tasks[tdi_task.name] = tdi_task
20
 
21
+ tcr_task = TcrTask(model_dict=all_models)
22
+ all_tasks[tcr_task.name] = tcr_task
23
+
24
+
25
+ # create the model holders. hold the model and the tokenizer, lazy download
26
+ # note that the list of relevent tasks needs to be stated.
27
  ppi_model = MammalObjectBroker(
28
+ model_path="ibm/biomed.omics.bl.sm.ma-ted-458m", task_list=[ppi_task.name,tcr_task.name]
29
  )
30
  all_models[ppi_model.name] = ppi_model
31
 
32
  tdi_model = MammalObjectBroker(
33
  model_path="ibm/biomed.omics.bl.sm.ma-ted-458m.dti_bindingdb_pkd",
34
+ task_list=[tdi_task.name],
35
  )
36
  all_models[tdi_model.name] = tdi_model
37
 
38
+ tcr_model = MammalObjectBroker(
39
+ model_path= "ibm/biomed.omics.bl.sm.ma-ted-458m.tcr_epitope_bind",
40
+ task_list=[tcr_task.name]
41
+ )
42
+ all_models[tcr_model.name] = tcr_model
43
 
44
  def create_application():
45
  def task_change(value):
46
  visibility = [gr.update(visible=(task == value)) for task in all_tasks.keys()]
 
47
  choices = [
48
  model_name
49
  for model_name, model in all_models.items()
mammal_demo/ppi_task.py CHANGED
@@ -140,9 +140,9 @@ class PpiTask(MammalTask):
140
  )
141
  with gr.Row():
142
  prompt_box = gr.Textbox(label="Mammal prompt", lines=5)
143
- score_box = gr.Number(label="PPI score")
144
  with gr.Row():
145
  decoded = gr.Textbox(label="Mammal output")
 
146
  run_mammal.click(
147
  fn=self.create_and_run_prompt,
148
  inputs=[model_name_widget, prot1, prot2],
 
140
  )
141
  with gr.Row():
142
  prompt_box = gr.Textbox(label="Mammal prompt", lines=5)
 
143
  with gr.Row():
144
  decoded = gr.Textbox(label="Mammal output")
145
+ score_box = gr.Number(label="PPI score")
146
  run_mammal.click(
147
  fn=self.create_and_run_prompt,
148
  inputs=[model_name_widget, prot1, prot2],