Spaces:
Sleeping
Sleeping
jennzhuge
commited on
Commit
·
d2cfbb3
1
Parent(s):
51eb37f
fix syntax error
Browse files
app.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
import os
|
| 2 |
import pandas as pd
|
| 3 |
-
import matplotlib.pyplot as plt
|
| 4 |
import gradio as gr
|
| 5 |
import numpy as np
|
| 6 |
import xgboost_infer
|
|
@@ -38,8 +38,8 @@ import xgboost_infer
|
|
| 38 |
# return f"https://example.com/images/{genus}.jpg"
|
| 39 |
|
| 40 |
def get_genuses(dna_file, dnaenv_file):
|
| 41 |
-
|
| 42 |
-
|
| 43 |
|
| 44 |
results = []
|
| 45 |
|
|
@@ -50,9 +50,10 @@ def get_genuses(dna_file, dnaenv_file):
|
|
| 50 |
genuses = xgboost_infer.infer()
|
| 51 |
|
| 52 |
results.append({
|
| 53 |
-
"sequence": dna_df['nucraw']
|
| 54 |
-
"predictions": pd.concat([dna_genuses, envdna_genuses], axis=0)
|
| 55 |
-
|
|
|
|
| 56 |
|
| 57 |
return results
|
| 58 |
|
|
@@ -81,7 +82,7 @@ def gradio_interface(file):
|
|
| 81 |
# Gradio interface
|
| 82 |
with gr.Blocks() as demo:
|
| 83 |
with gr.Column():
|
| 84 |
-
gr.Markdown("#
|
| 85 |
file_input = gr.File(label="Upload DNA CSV file", file_types=['csv'])
|
| 86 |
output_table = gr.Dataframe(headers=["DNA", "Coord", "DNA Only Pred Genus", "DNA Only Prob", "DNA & Env Pred Genus", "DNA & Env Prob"])
|
| 87 |
|
|
|
|
| 1 |
import os
|
| 2 |
import pandas as pd
|
| 3 |
+
# import matplotlib.pyplot as plt
|
| 4 |
import gradio as gr
|
| 5 |
import numpy as np
|
| 6 |
import xgboost_infer
|
|
|
|
| 38 |
# return f"https://example.com/images/{genus}.jpg"
|
| 39 |
|
| 40 |
def get_genuses(dna_file, dnaenv_file):
|
| 41 |
+
dna_df = pd.read_csv(dna_file.name)
|
| 42 |
+
dnaenv_df = pd.read_csv(dnaenv_file.name)
|
| 43 |
|
| 44 |
results = []
|
| 45 |
|
|
|
|
| 50 |
genuses = xgboost_infer.infer()
|
| 51 |
|
| 52 |
results.append({
|
| 53 |
+
"sequence": dna_df['nucraw'],
|
| 54 |
+
# "predictions": pd.concat([dna_genuses, envdna_genuses], axis=0)
|
| 55 |
+
'predictions': genuses
|
| 56 |
+
})
|
| 57 |
|
| 58 |
return results
|
| 59 |
|
|
|
|
| 82 |
# Gradio interface
|
| 83 |
with gr.Blocks() as demo:
|
| 84 |
with gr.Column():
|
| 85 |
+
gr.Markdown("# DNA Identifier Tool")
|
| 86 |
file_input = gr.File(label="Upload DNA CSV file", file_types=['csv'])
|
| 87 |
output_table = gr.Dataframe(headers=["DNA", "Coord", "DNA Only Pred Genus", "DNA Only Prob", "DNA & Env Pred Genus", "DNA & Env Prob"])
|
| 88 |
|