Spaces:
Sleeping
Sleeping
Change layout to 2 columns
Browse files
app.py
CHANGED
@@ -154,6 +154,7 @@ def predict_genus(method: str, dna_sequence: str, latitude: str, longitude: str)
|
|
154 |
ax.set_title("Genus Prediction")
|
155 |
ax.set_xlabel("Genus")
|
156 |
ax.set_ylabel("Probability")
|
|
|
157 |
ax.set_xticklabels(top_k.index.astype(str), rotation=90)
|
158 |
fig.subplots_adjust(bottom=0.3)
|
159 |
fig.canvas.draw()
|
@@ -231,27 +232,21 @@ with gr.Blocks() as demo:
|
|
231 |
that we precomputed and stored in a Pinecone index. Thie method
|
232 |
DOES NOT examine ecological layer data.
|
233 |
""")
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
predict_button.click(
|
251 |
-
fn=predict_genus,
|
252 |
-
inputs=[method_dropdown, inp_dna, inp_lat, inp_lng],
|
253 |
-
outputs=genus_output
|
254 |
-
)
|
255 |
|
256 |
with gr.Tab("DNA Embedding Space Visualizer"):
|
257 |
gr.Markdown("""
|
@@ -262,24 +257,20 @@ with gr.Blocks() as demo:
|
|
262 |
learning to cluster similar DNA sequences together.
|
263 |
""")
|
264 |
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
fn=cluster_dna,
|
281 |
-
inputs=top_k_slider,
|
282 |
-
outputs=visualize_output
|
283 |
-
)
|
284 |
|
285 |
demo.launch()
|
|
|
154 |
ax.set_title("Genus Prediction")
|
155 |
ax.set_xlabel("Genus")
|
156 |
ax.set_ylabel("Probability")
|
157 |
+
ax.set_xticks(range(len(top_k)))
|
158 |
ax.set_xticklabels(top_k.index.astype(str), rotation=90)
|
159 |
fig.subplots_adjust(bottom=0.3)
|
160 |
fig.canvas.draw()
|
|
|
232 |
that we precomputed and stored in a Pinecone index. Thie method
|
233 |
DOES NOT examine ecological layer data.
|
234 |
""")
|
235 |
+
|
236 |
+
with gr.Row():
|
237 |
+
with gr.Column():
|
238 |
+
method_dropdown = gr.Dropdown(
|
239 |
+
choices=["cosine", "fine_tuned_model"], value="fine_tuned_model",
|
240 |
+
)
|
241 |
+
predict_button = gr.Button("Predict Genus")
|
242 |
+
with gr.Column():
|
243 |
+
genus_output = gr.Image()
|
244 |
+
|
245 |
+
predict_button.click(
|
246 |
+
fn=predict_genus,
|
247 |
+
inputs=[method_dropdown, inp_dna, inp_lat, inp_lng],
|
248 |
+
outputs=genus_output
|
249 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
250 |
|
251 |
with gr.Tab("DNA Embedding Space Visualizer"):
|
252 |
gr.Markdown("""
|
|
|
257 |
learning to cluster similar DNA sequences together.
|
258 |
""")
|
259 |
|
260 |
+
with gr.Row():
|
261 |
+
with gr.Column():
|
262 |
+
top_k_slider = gr.Slider(
|
263 |
+
minimum=1, maximum=10, step=1, value=5,
|
264 |
+
label="Number of top genera to visualize",
|
265 |
+
)
|
266 |
+
visualize_button = gr.Button("Visualize Embedding Space")
|
267 |
+
with gr.Column():
|
268 |
+
visualize_output = gr.Image()
|
269 |
+
|
270 |
+
visualize_button.click(
|
271 |
+
fn=cluster_dna,
|
272 |
+
inputs=top_k_slider,
|
273 |
+
outputs=visualize_output
|
274 |
+
)
|
|
|
|
|
|
|
|
|
275 |
|
276 |
demo.launch()
|