Spaces:
Runtime error
Runtime error
Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -14,17 +14,17 @@ def predict_ui(sequence):
|
|
| 14 |
is_positive = prob > 0.5
|
| 15 |
|
| 16 |
label = "𧬠Cleavage Site Likely" if is_positive else "β No Cleavage Site"
|
| 17 |
-
color = "#22c55e" if is_positive else "#ef4444"
|
| 18 |
|
| 19 |
return (
|
| 20 |
f"{prob:.5f}",
|
| 21 |
f"{percent:.3f}%",
|
| 22 |
-
f"<span style='color:{color}; font-weight:bold'>{label}</span>",
|
| 23 |
percent
|
| 24 |
)
|
| 25 |
|
| 26 |
# -----------------------------
|
| 27 |
-
#
|
| 28 |
# -----------------------------
|
| 29 |
css = """
|
| 30 |
body {
|
|
@@ -32,28 +32,52 @@ body {
|
|
| 32 |
font-family: 'Segoe UI', sans-serif;
|
| 33 |
}
|
| 34 |
|
|
|
|
| 35 |
.container {
|
| 36 |
-
max-width:
|
| 37 |
margin: auto;
|
| 38 |
-
padding:
|
| 39 |
}
|
| 40 |
|
|
|
|
| 41 |
.card {
|
| 42 |
-
background: rgba(255,
|
| 43 |
-
backdrop-filter: blur(
|
| 44 |
-
border-radius:
|
| 45 |
-
padding:
|
| 46 |
-
box-shadow: 0
|
| 47 |
}
|
| 48 |
|
| 49 |
-
|
| 50 |
-
|
|
|
|
|
|
|
|
|
|
| 51 |
}
|
| 52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
button {
|
| 54 |
-
border-radius:
|
|
|
|
| 55 |
font-weight: bold;
|
| 56 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
"""
|
| 58 |
|
| 59 |
with gr.Blocks(css=css) as demo:
|
|
@@ -62,29 +86,29 @@ with gr.Blocks(css=css) as demo:
|
|
| 62 |
with gr.Column(elem_classes="card"):
|
| 63 |
|
| 64 |
gr.Markdown(
|
| 65 |
-
"# 𧬠BiTransformer Predictor\n"
|
| 66 |
-
|
| 67 |
)
|
| 68 |
|
| 69 |
seq_input = gr.Textbox(
|
| 70 |
label="Protein Sequence",
|
| 71 |
-
placeholder="Paste
|
| 72 |
-
lines=
|
| 73 |
)
|
| 74 |
|
| 75 |
-
predict_btn = gr.Button("π
|
| 76 |
|
| 77 |
with gr.Row():
|
| 78 |
-
prob_output = gr.Textbox(label="
|
| 79 |
-
percent_output = gr.Textbox(label="
|
| 80 |
|
| 81 |
-
label_output = gr.HTML(label="
|
| 82 |
|
| 83 |
confidence_bar = gr.Slider(
|
| 84 |
minimum=0,
|
| 85 |
maximum=100,
|
| 86 |
step=0.1,
|
| 87 |
-
label="
|
| 88 |
interactive=False
|
| 89 |
)
|
| 90 |
|
|
|
|
| 14 |
is_positive = prob > 0.5
|
| 15 |
|
| 16 |
label = "𧬠Cleavage Site Likely" if is_positive else "β No Cleavage Site"
|
| 17 |
+
color = "#22c55e" if is_positive else "#ef4444"
|
| 18 |
|
| 19 |
return (
|
| 20 |
f"{prob:.5f}",
|
| 21 |
f"{percent:.3f}%",
|
| 22 |
+
f"<span style='color:{color}; font-weight:bold; font-size:18px'>{label}</span>",
|
| 23 |
percent
|
| 24 |
)
|
| 25 |
|
| 26 |
# -----------------------------
|
| 27 |
+
# π¨ Compact + Visible UI
|
| 28 |
# -----------------------------
|
| 29 |
css = """
|
| 30 |
body {
|
|
|
|
| 32 |
font-family: 'Segoe UI', sans-serif;
|
| 33 |
}
|
| 34 |
|
| 35 |
+
/* Center container */
|
| 36 |
.container {
|
| 37 |
+
max-width: 650px;
|
| 38 |
margin: auto;
|
| 39 |
+
padding-top: 30px;
|
| 40 |
}
|
| 41 |
|
| 42 |
+
/* Card */
|
| 43 |
.card {
|
| 44 |
+
background: rgba(255,255,255,0.05);
|
| 45 |
+
backdrop-filter: blur(10px);
|
| 46 |
+
border-radius: 16px;
|
| 47 |
+
padding: 18px;
|
| 48 |
+
box-shadow: 0 6px 20px rgba(0,0,0,0.25);
|
| 49 |
}
|
| 50 |
|
| 51 |
+
/* Title fix */
|
| 52 |
+
h1 {
|
| 53 |
+
color: #ffffff !important;
|
| 54 |
+
text-align: center;
|
| 55 |
+
margin-bottom: 5px;
|
| 56 |
}
|
| 57 |
|
| 58 |
+
h3 {
|
| 59 |
+
color: #cbd5f5;
|
| 60 |
+
text-align: center;
|
| 61 |
+
margin-top: 0;
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
/* Reduce input height */
|
| 65 |
+
textarea {
|
| 66 |
+
min-height: 70px !important;
|
| 67 |
+
border-radius: 10px !important;
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
/* Buttons */
|
| 71 |
button {
|
| 72 |
+
border-radius: 10px !important;
|
| 73 |
+
padding: 8px 12px !important;
|
| 74 |
font-weight: bold;
|
| 75 |
}
|
| 76 |
+
|
| 77 |
+
/* Reduce spacing */
|
| 78 |
+
.gr-box {
|
| 79 |
+
padding: 5px !important;
|
| 80 |
+
}
|
| 81 |
"""
|
| 82 |
|
| 83 |
with gr.Blocks(css=css) as demo:
|
|
|
|
| 86 |
with gr.Column(elem_classes="card"):
|
| 87 |
|
| 88 |
gr.Markdown(
|
| 89 |
+
"# 𧬠BiTransformer Cleavage Site Predictor\n"
|
| 90 |
+
|
| 91 |
)
|
| 92 |
|
| 93 |
seq_input = gr.Textbox(
|
| 94 |
label="Protein Sequence",
|
| 95 |
+
placeholder="Paste sequence...",
|
| 96 |
+
lines=2
|
| 97 |
)
|
| 98 |
|
| 99 |
+
predict_btn = gr.Button("π Predict")
|
| 100 |
|
| 101 |
with gr.Row():
|
| 102 |
+
prob_output = gr.Textbox(label="Probability")
|
| 103 |
+
percent_output = gr.Textbox(label="Percentage")
|
| 104 |
|
| 105 |
+
label_output = gr.HTML(label="Result")
|
| 106 |
|
| 107 |
confidence_bar = gr.Slider(
|
| 108 |
minimum=0,
|
| 109 |
maximum=100,
|
| 110 |
step=0.1,
|
| 111 |
+
label="Confidence",
|
| 112 |
interactive=False
|
| 113 |
)
|
| 114 |
|