Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,9 +1,21 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
-
from transformers import
|
| 3 |
|
| 4 |
-
|
| 5 |
-
|
|
|
|
| 6 |
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
+
from transformers import AutoTokenizer, AutoModel
|
| 3 |
|
| 4 |
+
# Load model and tokenizer
|
| 5 |
+
tokenizer = AutoTokenizer.from_pretrained("medicalai/ClinicalBERT")
|
| 6 |
+
model = AutoModel.from_pretrained("medicalai/ClinicalBERT")
|
| 7 |
|
| 8 |
+
# Define app layout
|
| 9 |
+
st.title("ClinicalBERT Inference App")
|
| 10 |
+
input_text = st.text_input("Enter clinical text:")
|
| 11 |
+
|
| 12 |
+
if input_text:
|
| 13 |
+
# Preprocess input
|
| 14 |
+
inputs = tokenizer(input_text, return_tensors="pt")
|
| 15 |
+
|
| 16 |
+
# Perform inference
|
| 17 |
+
with st.spinner("Processing..."):
|
| 18 |
+
outputs = model(**inputs)
|
| 19 |
+
|
| 20 |
+
# Display results (adjust based on model output format)
|
| 21 |
+
st.write("Model outputs:", outputs)
|