Spaces:
Build error
Build error
Ronio Jerico Roque
Update spinner messages to reflect file upload actions across multiple classes
c75d56b Download classes/pull_through_offers.py from roniorque/df_ai_int: direct link, hf CLI and curl.
- Browser
- Download file 2.44 kB
-
https://huggingface.co/spaces/roniorque/df_ai_int/resolve/main/classes/pull_through_offers.py
- Command line
-
hf download hf://spaces/roniorque/df_ai_int/classes/pull_through_offers.py
-
curl -L -o pull_through_offers.py https://huggingface.co/spaces/roniorque/df_ai_int/resolve/main/classes/pull_through_offers.py
2.44 kB
| import streamlit as st | |
| import requests | |
| from dotenv import load_dotenv | |
| import os | |
| import time | |
| from helper.telemetry import collect_telemetry | |
| from helper.upload_File import uploadFile | |
| from helper.button_behaviour import hide_button, unhide_button | |
| from helper.initialize_analyze_session import initialize_analyze_session | |
| import pandas as pd | |
| class PullThroughOffers: | |
| def __init__(self, model_url): | |
| self.model_url = model_url | |
| #self.analyst_name = analyst_name | |
| #self.data_src = data_src | |
| #self.analyst_description = analyst_description | |
| self.initialize() | |
| self.row1() | |
| def initialize(self): | |
| # FOR ENV | |
| load_dotenv() | |
| if 'pull_through_offers' not in st.session_state: | |
| st.session_state['pull_through_offers'] = '' | |
| def process(self): | |
| session = st.session_state.analyze | |
| if (self.pull_through_offers) and session == 'clicked': | |
| pull_through_offers = "" | |
| with st.spinner('Uploading Pull Through Offers...', show_time=True): | |
| st.write('') | |
| try: | |
| pull_through_offers += f"\nPull Through Offers: {self.pull_through_offers}" | |
| except KeyError: | |
| pass | |
| debug_info_pull_through_offers = {'data_field' : 'Pull through offers', 'result': pull_through_offers} | |
| if self.pull_through_offers: | |
| st.session_state['pull_through_offers'] = 'uploaded' | |
| collect_telemetry(debug_info_pull_through_offers) | |
| #with st.expander("Debug information", icon="⚙"): | |
| # st.write(debug_info) | |
| st.session_state['analyzing'] = False | |
| def row1(self): | |
| self.pull_through_offers = st.text_input("Pull through offers (Business Context)", placeholder='Enter Pull through offers') | |
| st.session_state['analyzing'] = False | |
| self.process() | |
| if __name__ == "__main__": | |
| st.set_page_config(layout="wide") | |
| upload = uploadFile() |