Nano_PLM_Demo / app.py
sudhir2016's picture
Update app.py
49f1ac3 verified
import gradio as gr
from transformers import pipeline
MODEL_ID = "sudhir2016/PLM"
TASK = "text-classification"
predictor = pipeline(
task=TASK,
model=MODEL_ID,
device=-1 )
def predict_tm(sequence: str) -> str:
spaced_sequence = " ".join(list(sequence.strip().upper()))
result = predictor(spaced_sequence)
predicted_tm = result[0]['score']
return f"Predicted Melting Temperature (Tm): {predicted_tm:.2f} °C"
demo = gr.Interface(
fn=predict_tm,
inputs=gr.Textbox(
label="Enter Protein Amino Acid Sequence (1-letter code)",
placeholder="e.g., ACDEFGHIKLMNPQRSTVWY",
lines=5
),
outputs="text",
title="Nano Protein Language Model for Thermostability Prediction",
description="Enter an amino acid sequence (using the 1-letter code) to predict its melting temperature (Tm) in degrees Celsius.",
examples=[
["VKLGSGAYE"], # Example sequence 1
["MALWMRLLPLLALLALWGPDPAAAFVNQHLCGSHLVEALYLVCGERGFFYTPKA"], # Example sequence 2
]
)
demo.launch()