Spaces:
Runtime error
Runtime error
Merge pull request #42 from barun-saha/maintenance
Browse filesFiles changed (2)
- app.py+38-8
- requirements.txt+1-1
9 unmodified lines101112131415182 unmodified lines19819920020120220320420520620720820921021121259 unmodified lines2722732742752762779 unmodified linesfrom typing import List, Unionimport json5import streamlit as stfrom langchain_community.chat_message_histories import StreamlitChatMessageHistoryfrom langchain_core.messages import HumanMessage182 unmodified linesprogress_bar = st.progress(0, 'Preparing to call LLM...')response = ''for chunk in _get_llm().stream(formatted_template):response += chunk# Update the progress barprogress_percentage = min(len(response) / APPROX_TARGET_LENGTH, 0.95)progress_bar.progress(progress_percentage,text='Streaming content...this might take a while...')history.add_user_message(prompt)history.add_ai_message(response)59 unmodified lines)return Noneif DOWNLOAD_FILE_KEY in st.session_state:path = pathlib.Path(st.session_state[DOWNLOAD_FILE_KEY])9 unmodified lines10111213141516182 unmodified lines19920020120220320420520620720820921021121221321421521621721821922022122259 unmodified lines2822832842852862872882892902912922932942952962972982993003013023033043053063079 unmodified linesfrom typing import List, Unionimport json5import requestsimport streamlit as stfrom langchain_community.chat_message_histories import StreamlitChatMessageHistoryfrom langchain_core.messages import HumanMessage182 unmodified linesprogress_bar = st.progress(0, 'Preparing to call LLM...')response = ''try:for chunk in _get_llm().stream(formatted_template):response += chunk# Update the progress barprogress_percentage = min(len(response) / APPROX_TARGET_LENGTH, 0.95)progress_bar.progress(progress_percentage,text='Streaming content...this might take a while...')except requests.exceptions.ConnectionError:msg = ('A connection error occurred while streaming content from the LLM endpoint.'' Unfortunately, the slide deck cannot be generated. Please try again later.')logger.error(msg)st.error(msg)returnhistory.add_user_message(prompt)history.add_ai_message(response)59 unmodified lines)return Noneexcept RecursionError:st.error('Encountered an error while parsing JSON...''the slide deck cannot be created, unfortunately ☹''\nPlease try again later.')logger.error('Caught RecursionError while parsing JSON. Cannot generate the slide deck!')return Noneexcept Exception:st.error('Encountered an error while parsing JSON...''the slide deck cannot be created, unfortunately ☹''\nPlease try again later.')logger.error('Caught ValueError: failed to parse JSON!')return Noneif DOWNLOAD_FILE_KEY in st.session_state:path = pathlib.Path(st.session_state[DOWNLOAD_FILE_KEY])
1234567aiohttp==3.10.5python-dotenv[cli]~=1.0.0gitpython==3.1.43json_repair==0.15.3idna==3.7jinja2==3.1.4Pillow==10.3.01234567aiohttp==3.10.5python-dotenv[cli]~=1.0.0gitpython==3.1.43json-repair==0.29.2idna==3.7jinja2==3.1.4Pillow==10.3.0
app.py+38-8
requirements.txt+1-1