Jesus Andres Correal Ortiz
commited on
Commit
·
fe0f1f2
1
Parent(s):
86c0a21
Main file updated
Browse files- app.py +24 -4
- fine-tuning.ipynb +0 -0
app.py
CHANGED
@@ -1,7 +1,27 @@
|
|
1 |
import streamlit as st
|
|
|
|
|
2 |
|
3 |
-
|
4 |
-
|
|
|
|
|
5 |
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
+
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
3 |
+
import torch
|
4 |
|
5 |
+
# Load the model and tokenizer
|
6 |
+
model_name = "acorreal/phi3-project-management"
|
7 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
8 |
+
model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
9 |
|
10 |
+
# Streamlit app
|
11 |
+
st.title('Project Management Educational Tutor')
|
12 |
+
st.write('This app uses the "acorreal/phi3-project-management" model')
|
13 |
+
|
14 |
+
user_input = st.text_area("Enter your project management question or topic here:")
|
15 |
+
|
16 |
+
if st.button('Get Response'):
|
17 |
+
if user_input:
|
18 |
+
inputs = tokenizer(user_input, return_tensors="pt")
|
19 |
+
with torch.no_grad():
|
20 |
+
outputs = model(**inputs)
|
21 |
+
logits = outputs.logits
|
22 |
+
predicted_class_id = logits.argmax().item()
|
23 |
+
|
24 |
+
st.write(f"Predicted class ID: {predicted_class_id}")
|
25 |
+
# You can add more logic here to provide detailed responses based on the predicted_class_id
|
26 |
+
else:
|
27 |
+
st.write("Please enter a question or topic to get a response.")
|
fine-tuning.ipynb
ADDED
The diff for this file is too large to render.
See raw diff
|
|