Spaces:
Sleeping
Sleeping
Commit
·
7fa0302
1
Parent(s):
e04ec03
Update app.py
Browse files
app.py
CHANGED
@@ -49,19 +49,25 @@ def query(texts):
|
|
49 |
|
50 |
output = (dict(inputs = texts))
|
51 |
|
|
|
|
|
52 |
embeddings = pd.DataFrame(output)
|
53 |
embeddings.to_csv("embeddings.csv", index=False)
|
54 |
|
|
|
|
|
55 |
# If were to upload embeddings in huggingface dataset
|
56 |
faqs_embeddings = load_dataset('ITESM/embedded_faqs_medicare')
|
57 |
dataset_embeddings = torch.from_numpy(faqs_embeddings["train"].to_pandas().to_numpy()).to(torch.float)
|
58 |
|
|
|
59 |
# embeddings_new = pd.read_csv(embeddings.csv)
|
60 |
# dataset_embeddings = torch.from_numpy(embeddings_new.to_pandas().to_numpy()).to(torch.float)
|
61 |
|
62 |
question = ["How can Medicare help me?"]
|
63 |
output = query(question)
|
64 |
|
|
|
65 |
|
66 |
query_embeddings = torch.FloatTensor(output)
|
67 |
print(f"The size of our embedded dataset is {dataset_embeddings.shape} and of our embedded query is {query_embeddings.shape}.")
|
|
|
49 |
|
50 |
output = (dict(inputs = texts))
|
51 |
|
52 |
+
print("output done")
|
53 |
+
|
54 |
embeddings = pd.DataFrame(output)
|
55 |
embeddings.to_csv("embeddings.csv", index=False)
|
56 |
|
57 |
+
print("embeddings done")
|
58 |
+
|
59 |
# If were to upload embeddings in huggingface dataset
|
60 |
faqs_embeddings = load_dataset('ITESM/embedded_faqs_medicare')
|
61 |
dataset_embeddings = torch.from_numpy(faqs_embeddings["train"].to_pandas().to_numpy()).to(torch.float)
|
62 |
|
63 |
+
print("dataset_embeddings done")
|
64 |
# embeddings_new = pd.read_csv(embeddings.csv)
|
65 |
# dataset_embeddings = torch.from_numpy(embeddings_new.to_pandas().to_numpy()).to(torch.float)
|
66 |
|
67 |
question = ["How can Medicare help me?"]
|
68 |
output = query(question)
|
69 |
|
70 |
+
print("output done")
|
71 |
|
72 |
query_embeddings = torch.FloatTensor(output)
|
73 |
print(f"The size of our embedded dataset is {dataset_embeddings.shape} and of our embedded query is {query_embeddings.shape}.")
|