from omegaconf import OmegaConf from query import VectaraQuery import os import requests import streamlit as st from PIL import Image def inject_custom_css(): st.markdown( """ """, unsafe_allow_html=True ) def launch_bot(): if 'cfg' not in st.session_state: cfg = OmegaConf.create({ 'customer_id': str(os.environ['VECTARA_CUSTOMER_ID']), 'corpus_id': str(os.environ['VECTARA_CORPUS_ID']), 'api_key': str(os.environ['VECTARA_API_KEY']), 'streaming': False }) st.session_state.cfg = cfg st.session_state.vq = VectaraQuery(cfg.api_key, cfg.customer_id, [cfg.corpus_id], "vectara-summary-ext-24-05-large") cfg = st.session_state.cfg vq = st.session_state.vq st.set_page_config(page_title="Media Demo", layout="wide") inject_custom_css() header_image = Image.open('header-image-2.png') cropped_image = header_image.crop((0, 0, header_image.width, 200)) st.image(cropped_image, use_column_width=True) # left side content with st.sidebar: image = Image.open('vectara-logo.png') st.markdown("## Welcome to Media Demo\n\n" "This demo uses Vectara to find the movie where a quote is from\n\n" "Covers movies from this [playlist](https://www.youtube.com/playlist?list=PLHPTxTxtC0ibVZrT2_WKWUl2SAxsKuKwx) of free movies") st.markdown("---") st.markdown( "## How this works?\n" "This app was built with [Vectara](https://vectara.com).\n" ) st.markdown("---") st.image(image, width=250) st.markdown("