Upload graph-embeddings.py
Browse files- graph-embeddings.py +11 -11
graph-embeddings.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
#!/
|
2 |
|
3 |
""" Work in progress
|
4 |
Plan:
|
@@ -51,22 +51,22 @@ def standard_embed_calc(text):
|
|
51 |
|
52 |
init()
|
53 |
|
54 |
-
|
55 |
-
|
|
|
|
|
|
|
56 |
|
57 |
|
58 |
print("generating embeddings for each now")
|
59 |
emb1 = standard_embed_calc(text1)
|
60 |
-
emb2 = standard_embed_calc(text2)
|
61 |
-
|
62 |
graph1=emb1.tolist()
|
63 |
-
graph2=emb2.tolist()
|
64 |
-
|
65 |
-
fig, ax = plt.subplots()
|
66 |
-
|
67 |
-
# Plot the two lists on the same graph using the read labels
|
68 |
ax.plot(graph1, label=text1[:20])
|
69 |
-
|
|
|
|
|
|
|
|
|
70 |
|
71 |
# Add labels, title, and legend
|
72 |
#ax.set_xlabel('Index')
|
|
|
1 |
+
#!/bin/env python
|
2 |
|
3 |
""" Work in progress
|
4 |
Plan:
|
|
|
51 |
|
52 |
init()
|
53 |
|
54 |
+
fig, ax = plt.subplots()
|
55 |
+
|
56 |
+
|
57 |
+
text1 = input("First word or prompt: ")
|
58 |
+
text2 = input("Second prompt(or leave blank): ")
|
59 |
|
60 |
|
61 |
print("generating embeddings for each now")
|
62 |
emb1 = standard_embed_calc(text1)
|
|
|
|
|
63 |
graph1=emb1.tolist()
|
|
|
|
|
|
|
|
|
|
|
64 |
ax.plot(graph1, label=text1[:20])
|
65 |
+
|
66 |
+
if len(text2) >0:
|
67 |
+
emb2 = standard_embed_calc(text2)
|
68 |
+
graph2=emb2.tolist()
|
69 |
+
ax.plot(graph2, label=text2[:20])
|
70 |
|
71 |
# Add labels, title, and legend
|
72 |
#ax.set_xlabel('Index')
|