import streamlit as st | |
from transformers import AutoModelForSequenceClassification, AutoTokenizer | |
import torch | |
# Load the model and tokenizer | |
model_name = "acorreal/phi3-project-management" | |
tokenizer = AutoTokenizer.from_pretrained(model_name) | |
model = AutoModelForSequenceClassification.from_pretrained(model_name) | |
# Streamlit app | |
st.title('Project Management Educational Tutor') | |
st.write('This app uses the "acorreal/phi3-project-management" model') | |
user_input = st.text_area("Enter your project management question or topic here:") | |
if st.button('Get Response'): | |
if user_input: | |
inputs = tokenizer(user_input, return_tensors="pt") | |
with torch.no_grad(): | |
outputs = model(**inputs) | |
logits = outputs.logits | |
predicted_class_id = logits.argmax().item() | |
st.write(f"Predicted class ID: {predicted_class_id}") | |
# You can add more logic here to provide detailed responses based on the predicted_class_id | |
else: | |
st.write("Please enter a question or topic to get a response.") | |