File size: 1,052 Bytes
86c0a21 fe0f1f2 86c0a21 fe0f1f2 86c0a21 fe0f1f2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
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.")
|