Create app_.py
Browse files
app_.py
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import pandas as pd
|
| 3 |
+
import umap
|
| 4 |
+
import matplotlib.pyplot as plt
|
| 5 |
+
import os
|
| 6 |
+
import tempfile
|
| 7 |
+
import scanpy as sc
|
| 8 |
+
import argparse
|
| 9 |
+
import subprocess
|
| 10 |
+
from io import BytesIO
|
| 11 |
+
from evaluate import AnndataProcessor
|
| 12 |
+
from accelerate import Accelerator
|
| 13 |
+
from huggingface_hub import hf_hub_download
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
def main(input_file_path, species):
|
| 17 |
+
|
| 18 |
+
# clone and cd into UCE repo
|
| 19 |
+
os.system('git clone https://github.com/minwoosun/UCE.git')
|
| 20 |
+
os.chdir('UCE')
|
| 21 |
+
|
| 22 |
+
# python eval_single_anndata.py --adata_path "./data/10k_pbmcs_proc.h5ad" --dir "./" --model_loc "minwoosun/uce-100m"
|
| 23 |
+
script_name = "eval_single_anndata.py"
|
| 24 |
+
args = ["--adata_path", input_file_path, "--dir", "./", "--model_loc", "minwoosun/uce-100m"]
|
| 25 |
+
command = ["python", script_name] + args
|
| 26 |
+
|
| 27 |
+
try:
|
| 28 |
+
result = subprocess.run(command, capture_output=True, text=True, check=True)
|
| 29 |
+
print(result.stdout)
|
| 30 |
+
print(result.stderr)
|
| 31 |
+
except subprocess.CalledProcessError as e:
|
| 32 |
+
print(f"Error executing command: {e}")
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
if __name__ == "__main__":
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
|