Spaces:
Running
on
Zero
Running
on
Zero
Update main.py
Browse files
main.py
CHANGED
@@ -34,14 +34,6 @@ index.add(vectors)
|
|
34 |
# Load the model for later use in embeddings
|
35 |
model = sentence_transformers.SentenceTransformer("allenai-specter")
|
36 |
|
37 |
-
# Choose random search placeholder
|
38 |
-
placeholder = random.choice([
|
39 |
-
"design for additive manufacturing",
|
40 |
-
"best practices for agent based modeling"
|
41 |
-
"arctic environmental science",
|
42 |
-
"analysis of student teamwork"
|
43 |
-
])
|
44 |
-
|
45 |
# Define the search function
|
46 |
def search(query: str, k: int):
|
47 |
query = numpy.expand_dims(model.encode(query), axis=0)
|
@@ -80,7 +72,15 @@ def search(query: str, k: int):
|
|
80 |
with gradio.Blocks() as demo:
|
81 |
with gradio.Group():
|
82 |
query = gradio.Textbox(
|
83 |
-
placeholder
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
)
|
85 |
with gradio.Accordion("Settings", open=False):
|
86 |
k = gradio.Number(10.0, label="Number of results", precision=0)
|
|
|
34 |
# Load the model for later use in embeddings
|
35 |
model = sentence_transformers.SentenceTransformer("allenai-specter")
|
36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
# Define the search function
|
38 |
def search(query: str, k: int):
|
39 |
query = numpy.expand_dims(model.encode(query), axis=0)
|
|
|
72 |
with gradio.Blocks() as demo:
|
73 |
with gradio.Group():
|
74 |
query = gradio.Textbox(
|
75 |
+
placeholder = random.choice([
|
76 |
+
"design for additive manufacturing",
|
77 |
+
"best practices for agent based modeling"
|
78 |
+
"arctic environmental science",
|
79 |
+
"analysis of student teamwork"
|
80 |
+
]),
|
81 |
+
show_label=False,
|
82 |
+
lines=1,
|
83 |
+
max_lines=1
|
84 |
)
|
85 |
with gradio.Accordion("Settings", open=False):
|
86 |
k = gradio.Number(10.0, label="Number of results", precision=0)
|