File size: 1,063 Bytes
ac2467f
 
 
 
 
 
 
 
 
 
 
 
c52c91c
a3aa9a4
ac2467f
 
c52c91c
ac2467f
 
 
 
c52c91c
 
ac2467f
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# 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]}')