Skip to content

Commit

Permalink
streamlit app
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinKalema committed Jun 11, 2024
1 parent defbd58 commit 9a91be4
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import streamlit as st
from fastai.text.all import *

@st.cache_resource
def load_model():
learn = load_learner('text_classifier_learner.pth')
return learn

learn = load_model()

# Streamlit app
st.title('ULMFiT Swahili News Article Classifier')

# Text input
user_text = st.text_area('Enter text for classification')

if st.button('Classify'):
if user_text:
pred_class, pred_idx, outputs = learn.predict(user_text)
st.write(f"Predicted Class: {pred_class}")
else:
st.write("Please enter text to classify.")

if __name__ == '__main__':
st.run()

0 comments on commit 9a91be4

Please sign in to comment.