mv_recom / app.py
HConley's picture
Correcci贸n
a3aa9a4 verified
# Code for Streamlit webapp
import streamlit as st
import sys
import os
root_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(root_dir)
from src.models.plot_similarity_finder import plot_simil
# WebApp title and subtitle
st.title('Film Recommender')
st.subheader("Write a plot and I'll look for films with similar ideas.")
# Plot input.
user_plot = st.text_area("Write your plot here...")
# Generaci贸n de la respuesta.
# Agregue un bot贸n "Responder" a la interfaz de usuario
if st.button('Search'):
with st.spinner('Reading the plot...'):
# Procesamiento
result = plot_simil(user_plot)
# Muestra de la respuesta y las p谩ginas (fuentes)
st.markdown(f'{str.capitalize(result[0][1])}, {result[0][0]}')
st.markdown(f'{str.capitalize(result[1][1])}, {result[1][0]}')
st.markdown(f'{str.capitalize(result[2][1])}, {result[2][0]}')
st.markdown(f'{str.capitalize(result[3][1])}, {result[3][0]}')
st.markdown(f'{str.capitalize(result[4][1])}, {result[4][0]}')