Sean MacAvaney commited on
Commit
871af30
1 Parent(s): 45473be
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -12,7 +12,8 @@ def df2code(df):
12
  {rows}
13
  ])'''
14
 
15
- def predict(input, append, num_samples):
 
16
  doc2query.append = append
17
  doc2query.num_samples = num_samples
18
  code = f'''
@@ -21,7 +22,7 @@ def predict(input, append, num_samples):
21
  ```python
22
  import pandas as pd
23
  from pyterrier_doc2query import Doc2Query
24
- doc2query = Doc2Query(append={append}, num_samples={num_samples})
25
  doc2query({df2code(input)})
26
  ```
27
  '''
@@ -37,6 +38,11 @@ gr.Interface(
37
  wrap=True,
38
  label='Pipeline Input',
39
  value=[['0', 'The presence of communication amid scientific minds was equally important to the success of the Manhattan Project as scientific intellect was. The only cloud hanging over the impressive achievement of the atomic researchers and engineers is what their success truly meant; hundreds of thousands of innocent lives obliterated.']],
 
 
 
 
 
40
  ), gr.Checkbox(
41
  value=False,
42
  label="Append",
 
12
  {rows}
13
  ])'''
14
 
15
+ def predict(input, model, append, num_samples):
16
+ assert model == 'macavaney/doc2query-t5-base-msmarco'
17
  doc2query.append = append
18
  doc2query.num_samples = num_samples
19
  code = f'''
 
22
  ```python
23
  import pandas as pd
24
  from pyterrier_doc2query import Doc2Query
25
+ doc2query = Doc2Query({repr(model)}, append={append}, num_samples={num_samples})
26
  doc2query({df2code(input)})
27
  ```
28
  '''
 
38
  wrap=True,
39
  label='Pipeline Input',
40
  value=[['0', 'The presence of communication amid scientific minds was equally important to the success of the Manhattan Project as scientific intellect was. The only cloud hanging over the impressive achievement of the atomic researchers and engineers is what their success truly meant; hundreds of thousands of innocent lives obliterated.']],
41
+ ), gr.Dropdown(
42
+ choices=['macavaney/doc2query-t5-base-msmarco'],
43
+ value='macavaney/doc2query-t5-base-msmarco',
44
+ label='Model',
45
+ interactive=False,
46
  ), gr.Checkbox(
47
  value=False,
48
  label="Append",