Spaces:
Sleeping
Sleeping
Final: Streamlit app now uses hosted HF model
Browse files- app/app.py +3 -12
app/app.py
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
|
| 3 |
import torch
|
| 4 |
|
| 5 |
-
# Load model and tokenizer
|
| 6 |
@st.cache_resource
|
| 7 |
def load_model():
|
| 8 |
model = AutoModelForSeq2SeqLM.from_pretrained("Tuathe/codementor-flan")
|
|
@@ -13,19 +13,11 @@ model, tokenizer = load_model()
|
|
| 13 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 14 |
model.to(device)
|
| 15 |
|
| 16 |
-
# Streamlit page config
|
| 17 |
st.set_page_config(page_title="CodeMentor AI", page_icon="💻", layout="centered")
|
| 18 |
|
| 19 |
-
st.markdown(
|
| 20 |
-
|
| 21 |
-
unsafe_allow_html=True
|
| 22 |
-
)
|
| 23 |
-
st.markdown(
|
| 24 |
-
"<p style='text-align: center; font-size:18px;'>Your AI Coding Interview Assistant</p>",
|
| 25 |
-
unsafe_allow_html=True
|
| 26 |
-
)
|
| 27 |
|
| 28 |
-
# Sidebar info
|
| 29 |
with st.sidebar:
|
| 30 |
st.title("About CodeMentor AI")
|
| 31 |
st.info(
|
|
@@ -35,7 +27,6 @@ with st.sidebar:
|
|
| 35 |
st.markdown("---")
|
| 36 |
st.markdown("Created by Chetan")
|
| 37 |
|
| 38 |
-
# Chat interface
|
| 39 |
user_input = st.text_area("Ask your coding question here:", height=150)
|
| 40 |
|
| 41 |
if st.button("Get Answer"):
|
|
|
|
| 1 |
+
|
| 2 |
import streamlit as st
|
| 3 |
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
|
| 4 |
import torch
|
| 5 |
|
|
|
|
| 6 |
@st.cache_resource
|
| 7 |
def load_model():
|
| 8 |
model = AutoModelForSeq2SeqLM.from_pretrained("Tuathe/codementor-flan")
|
|
|
|
| 13 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 14 |
model.to(device)
|
| 15 |
|
|
|
|
| 16 |
st.set_page_config(page_title="CodeMentor AI", page_icon="💻", layout="centered")
|
| 17 |
|
| 18 |
+
st.markdown("<h1 style='text-align: center;'>CodeMentor AI</h1>", unsafe_allow_html=True)
|
| 19 |
+
st.markdown("<p style='text-align: center; font-size:18px;'>Your AI Coding Interview Assistant</p>", unsafe_allow_html=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
|
|
|
| 21 |
with st.sidebar:
|
| 22 |
st.title("About CodeMentor AI")
|
| 23 |
st.info(
|
|
|
|
| 27 |
st.markdown("---")
|
| 28 |
st.markdown("Created by Chetan")
|
| 29 |
|
|
|
|
| 30 |
user_input = st.text_area("Ask your coding question here:", height=150)
|
| 31 |
|
| 32 |
if st.button("Get Answer"):
|