Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -208,4 +208,6 @@ __marimo__/

# Data
raw/
processed/
processed/

.DS_store
20 changes: 20 additions & 0 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM python:3.12-slim

# Set the working directory in the container
WORKDIR /app

# Copy the requirements file into the container at /app
COPY frontend/requirements.txt /app/

# Install any needed packages specified in requirements.txt
RUN pip install --no-cache-dir -r requirements.txt

# Copy the application code into the container at /app
COPY frontend/readcrumbs_app.py /app/


# Make port 8501 available to the world outside this container
EXPOSE 8501

# Run app.py when the container launches
CMD ["streamlit", "run", "app.py"]
49 changes: 49 additions & 0 deletions frontend/readcrumbs_app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import streamlit as st
import requests

# API URL (probably need to change)
API_URL = "http://54.91.115.10:8000"

# Setup the streamlit page
title = "Readcrumbs"
description = "Provides book recommendations based on your favorite titles."
st.set_page_config(page_title=title, page_icon="📚")
st.title(title)
st.write(description)

input_text = st.text_area("What are some of your favorite books?", height=150)

# Button and Prediction Logic:
# Use the return value of st.button() to control when the prediction is made.
if st.button("Analyze Sentiment"):
# If no review is entered, show a warning.
if input_text.strip() == "":
st.warning("Please enter a movie review to analyze.")
else:
# Connect with the API to make a prediction. Should pass a list of titles.
input_list = input_text.split(", ")

# Create json data from input_list.
data_to_send = {
"items": input_list
}

response = requests.post(f"{API_URL}/predict", json=data_to_send)

if response.status_code == 200:
prediction = response.json()
prediction = prediction["recs"]

# Display result
st.subheader("Your Recommendations")
for r in prediction:
# display title
st.text(r)

# Footer with name and link to GitHub repository
st.divider()
col1, col2 = st.columns(2)
with col1:
st.markdown("Developed by Jordan Sinclair and Jordan Larson")
with col2:
st.link_button("GitHub Repository", "https://github.com/smiley-maker/readcrumbs")
1 change: 1 addition & 0 deletions frontend/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
streamlit
Loading