Spaces:
Running
Running
Commit
·
2d7464e
1
Parent(s):
104f6dd
ttt
Browse files
app.py
CHANGED
@@ -9,12 +9,10 @@ import spaces
|
|
9 |
@spaces.GPU
|
10 |
def get_embeddings(query, task):
|
11 |
model = SentenceTransformer("Linq-AI-Research/Linq-Embed-Mistral", use_auth_token=os.getenv("HF_TOKEN"))
|
12 |
-
task = "Given a question, retrieve passages that answer the question"
|
13 |
prompt = f"Instruct: {task}\nQuery: {query}"
|
14 |
query_embeddings = model.encode([prompt])
|
15 |
return query_embeddings
|
16 |
|
17 |
-
|
18 |
# Initialize a persistent Chroma client and retrieve collection
|
19 |
client = chromadb.PersistentClient(path="./chroma")
|
20 |
collection = client.get_collection(name="phil_de")
|
@@ -88,7 +86,7 @@ def flag_output(query, output_text, output_id):
|
|
88 |
max_textboxes = 30
|
89 |
|
90 |
with gr.Blocks(css=".custom-markdown { border: 1px solid #ccc; padding: 10px; border-radius: 5px; }") as demo:
|
91 |
-
gr.Markdown("Enter your query, filter authors (default is all), click **Search** to search. Click **Flag** if a result is relevant to the query and interesting to you.
|
92 |
with gr.Row():
|
93 |
with gr.Column():
|
94 |
inp = gr.Textbox(label="query", placeholder="Enter thought...")
|
|
|
9 |
@spaces.GPU
|
10 |
def get_embeddings(query, task):
|
11 |
model = SentenceTransformer("Linq-AI-Research/Linq-Embed-Mistral", use_auth_token=os.getenv("HF_TOKEN"))
|
|
|
12 |
prompt = f"Instruct: {task}\nQuery: {query}"
|
13 |
query_embeddings = model.encode([prompt])
|
14 |
return query_embeddings
|
15 |
|
|
|
16 |
# Initialize a persistent Chroma client and retrieve collection
|
17 |
client = chromadb.PersistentClient(path="./chroma")
|
18 |
collection = client.get_collection(name="phil_de")
|
|
|
86 |
max_textboxes = 30
|
87 |
|
88 |
with gr.Blocks(css=".custom-markdown { border: 1px solid #ccc; padding: 10px; border-radius: 5px; }") as demo:
|
89 |
+
gr.Markdown("Enter your query, filter authors (default is all), click **Search** to search. Click **Flag** if a result is relevant to the query and interesting to you.")
|
90 |
with gr.Row():
|
91 |
with gr.Column():
|
92 |
inp = gr.Textbox(label="query", placeholder="Enter thought...")
|