gradsyntax commited on
Commit
95f2cc5
·
verified ·
1 Parent(s): 9669ac0

Upload app files

Browse files
Files changed (3) hide show
  1. app.py +32 -0
  2. cell_classifier_model.joblib +3 -0
  3. requirements.txt +6 -0
app.py ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import joblib
3
+ import pandas as pd
4
+ from scipy.sparse import load_npz
5
+ import numpy as np
6
+
7
+ # Load the saved model and a small subset of the data for the demo
8
+ model = joblib.load("cell_classifier_model.joblib")
9
+ X_data = load_npz("./data/X_data.npz")
10
+
11
+ def predict_random_cell():
12
+ # Select a random cell from the dataset
13
+ random_index = np.random.randint(0, X_data.shape[0])
14
+ cell_data = X_data[random_index]
15
+
16
+ # Make a prediction
17
+ # The model expects a 2D array, so we reshape it
18
+ prediction = model.predict(cell_data.reshape(1, -1))[0]
19
+
20
+ return f"Selected a random cell from the dataset.\n\nModel Prediction: This cell belongs to Cluster {prediction}."
21
+
22
+ # Create the Gradio web interface
23
+ iface = gr.Interface(
24
+ fn=predict_random_cell,
25
+ inputs=None, # The user doesn't need to provide input
26
+ outputs=gr.Textbox(label="Prediction Result", lines=3),
27
+ title="CAR-T Cell Cluster Predictor",
28
+ description="Click the 'Submit' button to select a random cell from our dataset and see the model's prediction for which cluster it belongs to."
29
+ )
30
+
31
+ # Launch the app
32
+ iface.launch()
cell_classifier_model.joblib ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:156808da11a0dea0574581291680d2555ccc9f19d44e08151874df60bf19a325
3
+ size 63255577
requirements.txt ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ scikit-learn
2
+ pandas
3
+ numpy
4
+ scipy
5
+ joblib
6
+ gradio