Spaces:
Runtime error
Runtime error
hi
Browse files
app.py
CHANGED
@@ -215,7 +215,7 @@ with gr.Blocks() as demo:
|
|
215 |
|
216 |
with gr.Tab("Genus Prediction"):
|
217 |
gr.Markdown("""
|
218 |
-
|
219 |
|
220 |
A demo of predicting the genus of a DNA sequence using multiple
|
221 |
approaches (method dropdown):
|
@@ -228,35 +228,55 @@ with gr.Blocks() as demo:
|
|
228 |
that we precomputed and stored in a Pinecone index. Thie method
|
229 |
DOES NOT examine ecological layer data.
|
230 |
""")
|
231 |
-
gr.Interface(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
232 |
fn=predict_genus,
|
233 |
-
inputs=[
|
234 |
-
|
235 |
-
inp_dna,
|
236 |
-
inp_lat,
|
237 |
-
inp_lng,
|
238 |
-
],
|
239 |
-
outputs=["image"],
|
240 |
-
allow_flagging="never",
|
241 |
)
|
242 |
|
243 |
with gr.Tab("DNA Embedding Space Visualizer"):
|
244 |
gr.Markdown("""
|
245 |
-
|
246 |
|
247 |
We show a 2D t-SNE plot of the DNA embeddings of the five most common
|
248 |
genera in our dataset. This shows that the DNA Transformer model is
|
249 |
learning to cluster similar DNA sequences together.
|
250 |
""")
|
251 |
|
252 |
-
gr.Interface(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
253 |
fn=cluster_dna,
|
254 |
-
inputs=
|
255 |
-
|
256 |
-
label="Number of top genera to visualize")
|
257 |
-
],
|
258 |
-
outputs=["image"],
|
259 |
-
allow_flagging="never",
|
260 |
)
|
261 |
|
262 |
demo.launch()
|
|
|
215 |
|
216 |
with gr.Tab("Genus Prediction"):
|
217 |
gr.Markdown("""
|
218 |
+
## Genus prediction
|
219 |
|
220 |
A demo of predicting the genus of a DNA sequence using multiple
|
221 |
approaches (method dropdown):
|
|
|
228 |
that we precomputed and stored in a Pinecone index. Thie method
|
229 |
DOES NOT examine ecological layer data.
|
230 |
""")
|
231 |
+
# gr.Interface(
|
232 |
+
# fn=predict_genus,
|
233 |
+
# inputs=[
|
234 |
+
# gr.Dropdown(choices=["cosine", "fine_tuned_model"], value="fine_tuned_model"),
|
235 |
+
# inp_dna,
|
236 |
+
# inp_lat,
|
237 |
+
# inp_lng,
|
238 |
+
# ],
|
239 |
+
# outputs=["image"],
|
240 |
+
# allow_flagging="never",
|
241 |
+
# )
|
242 |
+
|
243 |
+
method_dropdown = gr.Dropdown(choices=["cosine", "fine_tuned_model"], value="fine_tuned_model")
|
244 |
+
predict_button = gr.Button("Predict Genus")
|
245 |
+
genus_output = gr.Image()
|
246 |
+
|
247 |
+
predict_button.click(
|
248 |
fn=predict_genus,
|
249 |
+
inputs=[method_dropdown, inp_dna, inp_lat, inp_lng],
|
250 |
+
outputs=genus_output
|
|
|
|
|
|
|
|
|
|
|
|
|
251 |
)
|
252 |
|
253 |
with gr.Tab("DNA Embedding Space Visualizer"):
|
254 |
gr.Markdown("""
|
255 |
+
## DNA Embedding Space Visualizer
|
256 |
|
257 |
We show a 2D t-SNE plot of the DNA embeddings of the five most common
|
258 |
genera in our dataset. This shows that the DNA Transformer model is
|
259 |
learning to cluster similar DNA sequences together.
|
260 |
""")
|
261 |
|
262 |
+
# gr.Interface(
|
263 |
+
# fn=cluster_dna,
|
264 |
+
# inputs=[
|
265 |
+
# gr.Slider(minimum=1, maximum=10, step=1, value=5,
|
266 |
+
# label="Number of top genera to visualize")
|
267 |
+
# ],
|
268 |
+
# outputs=["image"],
|
269 |
+
# allow_flagging="never",
|
270 |
+
# )
|
271 |
+
|
272 |
+
top_k_slider = gr.Slider(minimum=1, maximum=10, step=1, value=5, label="Number of top genera to visualize")
|
273 |
+
visualize_button = gr.Button("Visualize Embedding Space")
|
274 |
+
visualize_output = gr.Image()
|
275 |
+
|
276 |
+
visualize_button.click(
|
277 |
fn=cluster_dna,
|
278 |
+
inputs=top_k_slider,
|
279 |
+
outputs=visualize_output
|
|
|
|
|
|
|
|
|
280 |
)
|
281 |
|
282 |
demo.launch()
|