Spaces:
Sleeping
Sleeping
Sean MacAvaney
commited on
Commit
•
4692c69
1
Parent(s):
c0bdf6a
update
Browse files
app.py
CHANGED
@@ -4,7 +4,7 @@ import pyterrier as pt
|
|
4 |
pt.init()
|
5 |
from pyterrier_gradio import Demo, MarkdownFile, interface, df2code, code2md, EX_Q
|
6 |
|
7 |
-
retr = pt.TerrierRetrieve.from_dataset('
|
8 |
|
9 |
COLAB_NAME = 'pyterrier_retrieve.ipynb'
|
10 |
COLAB_INSTALL = '''
|
@@ -17,13 +17,13 @@ def predict(input, _, wmodel, num_results, pipe_text):
|
|
17 |
code = f'''import pandas as pd
|
18 |
import pyterrier as pt ; pt.init()
|
19 |
|
20 |
-
retr = pt.TerrierRetrieve.from_dataset('
|
21 |
'''
|
22 |
pipeline = retr
|
23 |
if pipe_text:
|
24 |
-
pipeline = pipeline >> pt.text.get_text(pt.get_dataset('irds:
|
25 |
code += f'''
|
26 |
-
pipeline = retr >> pt.text.get_text(pt.get_dataset('irds:
|
27 |
|
28 |
pipeline({df2code(input)})'''
|
29 |
else:
|
@@ -37,11 +37,15 @@ interface(
|
|
37 |
MarkdownFile('README.md'),
|
38 |
Demo(
|
39 |
predict,
|
40 |
-
|
|
|
|
|
|
|
|
|
41 |
[
|
42 |
gr.Dropdown(
|
43 |
-
choices=['
|
44 |
-
value='
|
45 |
label='Index',
|
46 |
interactive=False,
|
47 |
), gr.Dropdown(
|
|
|
4 |
pt.init()
|
5 |
from pyterrier_gradio import Demo, MarkdownFile, interface, df2code, code2md, EX_Q
|
6 |
|
7 |
+
retr = pt.TerrierRetrieve.from_dataset('vaswani', 'terrier_stemmed')
|
8 |
|
9 |
COLAB_NAME = 'pyterrier_retrieve.ipynb'
|
10 |
COLAB_INSTALL = '''
|
|
|
17 |
code = f'''import pandas as pd
|
18 |
import pyterrier as pt ; pt.init()
|
19 |
|
20 |
+
retr = pt.TerrierRetrieve.from_dataset('vaswani', 'terrier_stemmed', wmodel={repr(wmodel)}, num_results={num_results})
|
21 |
'''
|
22 |
pipeline = retr
|
23 |
if pipe_text:
|
24 |
+
pipeline = pipeline >> pt.text.get_text(pt.get_dataset('irds:vaswani'), 'text')
|
25 |
code += f'''
|
26 |
+
pipeline = retr >> pt.text.get_text(pt.get_dataset('irds:vaswani'), 'text')
|
27 |
|
28 |
pipeline({df2code(input)})'''
|
29 |
else:
|
|
|
37 |
MarkdownFile('README.md'),
|
38 |
Demo(
|
39 |
predict,
|
40 |
+
pd.DataFrame([
|
41 |
+
['1', 'measurement of dielectric constant of liquids by the use of microwave techniques'],
|
42 |
+
['2', 'mathematical analysis and design details of waveguide fed microwave radiations'],
|
43 |
+
['3', 'use of digital computers in the design of band pass filters having given phase and attenuation characteristics'],
|
44 |
+
], columns=['qid', 'query']),
|
45 |
[
|
46 |
gr.Dropdown(
|
47 |
+
choices=['vaswani stemmed'],
|
48 |
+
value='vaswani stemmed',
|
49 |
label='Index',
|
50 |
interactive=False,
|
51 |
), gr.Dropdown(
|