Spaces:
Sleeping
Sleeping
jennzhuge
commited on
Commit
·
a83006f
1
Parent(s):
4e8c8b5
hi
Browse files
app.py
CHANGED
@@ -11,13 +11,35 @@ def set_default_inputs():
|
|
11 |
DEFAULT_INPUTS["latitude"],
|
12 |
DEFAULT_INPUTS["longitude"])
|
13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
with gr.Blocks() as demo:
|
16 |
# Header section
|
17 |
gr.Markdown("# DNA Identifier Tool")
|
18 |
-
gr.Markdown("
|
|
|
|
|
|
|
19 |
|
20 |
-
with gr.Tab("Genus prediction"):
|
21 |
# Collect inputs for app (DNA and location)
|
22 |
with gr.Row():
|
23 |
inp_dna = gr.Textbox(label="DNA", placeholder="e.g. AACAATGTA... (will be automatically truncated to 660 characters)")
|
@@ -33,8 +55,13 @@ with gr.Blocks() as demo:
|
|
33 |
|
34 |
with gr.Row():
|
35 |
gr.Markdown('Make plot or table for Top 5 species')
|
|
|
|
|
|
|
|
|
36 |
|
37 |
with gr.Tab('DNA Embedding Space Similarity Visualizer'):
|
38 |
gr.Markdown("If the highest genus probability is very low for your DNA sequence, we can still examine the DNA embedding of the sequence in relation to known samples or clues.")
|
|
|
39 |
|
40 |
demo.launch()
|
|
|
11 |
DEFAULT_INPUTS["latitude"],
|
12 |
DEFAULT_INPUTS["longitude"])
|
13 |
|
14 |
+
def predict_genus():
|
15 |
+
dna_df = pd.read_csv(dna_file.name)
|
16 |
+
dnaenv_df = pd.read_csv(dnaenv_file.name)
|
17 |
+
|
18 |
+
results = []
|
19 |
+
|
20 |
+
# envdna_genuses = predict_genus_dna_env(dnaenv_df)
|
21 |
+
# dna_genuses = predict_genus_dna(dna_df)
|
22 |
+
# images = [get_genus_image(genus) for genus in top_5_genuses]
|
23 |
+
|
24 |
+
genuses = xgboost_infer.infer()
|
25 |
+
|
26 |
+
results.append({
|
27 |
+
"sequence": dna_df['nucraw'],
|
28 |
+
# "predictions": pd.concat([dna_genuses, envdna_genuses], axis=0)
|
29 |
+
'predictions': genuses
|
30 |
+
})
|
31 |
+
|
32 |
+
return results
|
33 |
+
|
34 |
|
35 |
with gr.Blocks() as demo:
|
36 |
# Header section
|
37 |
gr.Markdown("# DNA Identifier Tool")
|
38 |
+
gr.Markdown("Welcome to Lofi Amazon Beats' DNA Identifier Tool")
|
39 |
+
|
40 |
+
with gr.Tab("Genus Prediction"):
|
41 |
+
gr.Markdown("Input a DNA sequence and the coordinates at which its sample was taken to predict the genus of the DNA. Click 'I'm feeling lucky' to see our predictio for a random sequence.")
|
42 |
|
|
|
43 |
# Collect inputs for app (DNA and location)
|
44 |
with gr.Row():
|
45 |
inp_dna = gr.Textbox(label="DNA", placeholder="e.g. AACAATGTA... (will be automatically truncated to 660 characters)")
|
|
|
55 |
|
56 |
with gr.Row():
|
57 |
gr.Markdown('Make plot or table for Top 5 species')
|
58 |
+
|
59 |
+
with gr.Column():
|
60 |
+
genus_out = gr.Dataframe(headers=["DNA", "Coord", "DNA Only Pred Genus", "DNA Only Prob", "DNA & Env Pred Genus", "DNA & Env Prob"])
|
61 |
+
btn_run.click(predict_genus, inputs=[inp_dna, inp_lat, inp_lng], outputs=genus_out)
|
62 |
|
63 |
with gr.Tab('DNA Embedding Space Similarity Visualizer'):
|
64 |
gr.Markdown("If the highest genus probability is very low for your DNA sequence, we can still examine the DNA embedding of the sequence in relation to known samples or clues.")
|
65 |
+
|
66 |
|
67 |
demo.launch()
|