Update app.py
Browse files
app.py
CHANGED
@@ -47,10 +47,24 @@ def find_similar_questions(text_input):
|
|
47 |
answer = get_similar_links(query, db, embedding_vector)
|
48 |
return "\n".join(set(answer))
|
49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
|
51 |
iface = gr.Interface(
|
52 |
fn=find_similar_questions,
|
53 |
-
inputs=gr.inputs.Textbox(lines=20, label="Enter a Code Example"),
|
54 |
outputs=gr.outputs.Textbox(label="Similar Questions on Leetcode"),
|
55 |
title="π DSASearch Engine π€",
|
56 |
description="Find similar questions on Leetcode based on a code example.",
|
|
|
47 |
answer = get_similar_links(query, db, embedding_vector)
|
48 |
return "\n".join(set(answer))
|
49 |
|
50 |
+
s_example = """
|
51 |
+
class Solution(object):
|
52 |
+
def isValid(self, s):
|
53 |
+
stack = []
|
54 |
+
mapping = {")": "(", "}": "{", "]": "["}
|
55 |
+
for char in s:
|
56 |
+
if char in mapping:
|
57 |
+
top_element = stack.pop() if stack else '#'
|
58 |
+
if mapping[char] != top_element:
|
59 |
+
return False
|
60 |
+
else:
|
61 |
+
stack.append(char)
|
62 |
+
return not stack
|
63 |
+
"""
|
64 |
|
65 |
iface = gr.Interface(
|
66 |
fn=find_similar_questions,
|
67 |
+
inputs=gr.inputs.Textbox(lines=20, label="Enter a Code Example", value = s_example),
|
68 |
outputs=gr.outputs.Textbox(label="Similar Questions on Leetcode"),
|
69 |
title="π DSASearch Engine π€",
|
70 |
description="Find similar questions on Leetcode based on a code example.",
|