Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -43,13 +43,17 @@ def get_code(query):
|
|
43 |
truncate="LEFT").embeddings
|
44 |
|
45 |
# Retrieve the nearest neighbors
|
46 |
-
similar_item_ids = search_index.get_nns_by_vector(query_embed[0],
|
47 |
-
include_distances=True)
|
48 |
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
|
|
|
|
|
|
|
|
|
|
53 |
|
54 |
|
55 |
|
|
|
43 |
truncate="LEFT").embeddings
|
44 |
|
45 |
# Retrieve the nearest neighbors
|
46 |
+
similar_item_ids = search_index.get_nns_by_vector(query_embed[0],1)
|
|
|
47 |
|
48 |
+
|
49 |
+
return data_df.iloc[similar_item_ids[0]]['function_body'], data_df.iloc[similar_item_ids[0]]['file_path']
|
50 |
+
examples = ['compute diffusion of given data']
|
51 |
+
inputs = gr.Textbox(label='query')
|
52 |
+
outputs = [gr.Textbox(label='matched function'), gr.Textbox(label='File path')
|
53 |
+
title = "Search Code"
|
54 |
+
description = "Semantically search codebase using Cohere embed API. This demo uses Open AI point cloud codebase as an example"
|
55 |
+
iface = gr.Interface(fn=get_code, inputs=inputs, outputs=outputs, description = description)
|
56 |
+
iface.launch()
|
57 |
|
58 |
|
59 |
|