Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -36,36 +36,62 @@ if query:
|
|
36 |
print()
|
37 |
print("Similarity to " + str(query))
|
38 |
pd.set_option('display.max_rows', None)
|
39 |
-
|
40 |
-
table.head(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
st.header(f"Similar Words to {query}")
|
42 |
st.write(table.head(50))
|
43 |
#
|
|
|
44 |
print()
|
45 |
print("Human genes similar to " + str(query))
|
46 |
df1 = table
|
47 |
-
df2 = pd.read_csv('
|
48 |
m = df1.Word.isin(df2.symbol)
|
49 |
df1 = df1[m]
|
50 |
df1.rename(columns={'Word': 'Human Gene'}, inplace=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
print(df1.head(10))
|
|
|
|
|
52 |
print()
|
53 |
-
df1.head(10).to_csv("clotting_sim2.csv", index=True, header=False)
|
54 |
-
time.sleep(2)
|
55 |
st.header(f"Similar Genes to {query}")
|
56 |
-
st.write(
|
57 |
-
|
58 |
-
|
59 |
-
# findRelationships(query, df)
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
|
|
|
66 |
|
67 |
-
|
68 |
-
# similar_words = model.most_similar(word)
|
69 |
-
# output = json.dumps({"word": word, "similar_words": similar_words})
|
70 |
-
# st.write(output)
|
71 |
|
|
|
|
36 |
print()
|
37 |
print("Similarity to " + str(query))
|
38 |
pd.set_option('display.max_rows', None)
|
39 |
+
|
40 |
+
csv = table.head(50).to_csv(index=False).encode('utf-8')
|
41 |
+
st.download_button(
|
42 |
+
label=f"Download words similar to {query} in .csv format",
|
43 |
+
data=csv,
|
44 |
+
file_name='clotting_sim1.csv',
|
45 |
+
mime='text/csv'
|
46 |
+
)
|
47 |
+
|
48 |
+
json = table.head(50).to_json(index=True).encode('utf-8')
|
49 |
+
st.download_button(
|
50 |
+
label=f"Download words similar to {query} in .js format",
|
51 |
+
data=json,
|
52 |
+
file_name='clotting_sim1.js',
|
53 |
+
mime='json'
|
54 |
+
)
|
55 |
+
|
56 |
+
print(table.head(10))
|
57 |
+
table.head(50).to_csv("clotting_sim1.csv", index=True)
|
58 |
+
table.head(50).to_json("clotting_sim1.js", index=True)
|
59 |
st.header(f"Similar Words to {query}")
|
60 |
st.write(table.head(50))
|
61 |
#
|
62 |
+
|
63 |
print()
|
64 |
print("Human genes similar to " + str(query))
|
65 |
df1 = table
|
66 |
+
df2 = pd.read_csv('Human_Genes.csv')
|
67 |
m = df1.Word.isin(df2.symbol)
|
68 |
df1 = df1[m]
|
69 |
df1.rename(columns={'Word': 'Human Gene'}, inplace=True)
|
70 |
+
|
71 |
+
csv2 = df1.head(50).to_csv(index=False).encode('utf-8')
|
72 |
+
st.download_button(
|
73 |
+
label=f"Download genes similar to {query} in .csv format",
|
74 |
+
data=csv2,
|
75 |
+
file_name='clotting_sim2.csv',
|
76 |
+
mime='text/csv'
|
77 |
+
)
|
78 |
+
|
79 |
+
json2 = df1.head(50).to_json(index=True).encode('utf-8')
|
80 |
+
st.download_button(
|
81 |
+
label=f"Download words similar to {query} in .js format",
|
82 |
+
data=json2,
|
83 |
+
file_name='clotting_sim1.js',
|
84 |
+
mime='json'
|
85 |
+
)
|
86 |
print(df1.head(10))
|
87 |
+
df1.head(50).to_csv("clotting_sim2.csv", index=True)
|
88 |
+
df1.head(50).to_json("clotting_sim2.js", index=True)
|
89 |
print()
|
|
|
|
|
90 |
st.header(f"Similar Genes to {query}")
|
91 |
+
st.write(df1.head(50))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
|
93 |
+
from datasets import load_dataset
|
94 |
|
95 |
+
test_dataset = load_dataset("json", data_files="clotting_sim1.js", split="train")
|
|
|
|
|
|
|
96 |
|
97 |
+
test_dataset.save_to_disk("sim1.hf")
|