barunsaha commited on
Commit
469fc38
1 Parent(s): e48ea08

Enable debug messages

Browse files
Files changed (3) hide show
  1. app.py +4 -2
  2. global_config.py +1 -1
  3. llm_helper.py +3 -2
app.py CHANGED
@@ -190,7 +190,7 @@ def generate_presentation(topic: str, pptx_template: str, progress_bar):
190
  # Step 1: Generate the contents in JSON format using an LLM
191
  json_str = process_slides_contents(topic[:target_length], progress_bar)
192
  logging.debug(f'{topic[:target_length]=}')
193
- logging.debug(f'{json_str=}')
194
 
195
  # Step 2: Generate the slide deck based on the template specified
196
  if len(json_str) > 0:
@@ -237,7 +237,7 @@ def process_slides_contents(text: str, progress_bar: st.progress) -> str:
237
  f' Try doing it again or try again later.\n'
238
  f' Error message: {ex}')
239
 
240
- logging.debug(f'JSON: {json_str}')
241
 
242
  progress_bar.progress(50, text='Contents generated')
243
 
@@ -303,6 +303,8 @@ def show_bonus_stuff(ppt_headers: List[str]):
303
  with st.expander('Related Web references'):
304
  st.markdown('\n\n'.join(md_text_items))
305
 
 
 
306
  # # Avoid image generation. It costs time and an API call, so just limit to the text generation.
307
  # with st.expander('AI-generated image on the presentation topic'):
308
  # logging.info('Calling SDXL for image generation...')
 
190
  # Step 1: Generate the contents in JSON format using an LLM
191
  json_str = process_slides_contents(topic[:target_length], progress_bar)
192
  logging.debug(f'{topic[:target_length]=}')
193
+ logging.debug(f'{len(json_str)=}')
194
 
195
  # Step 2: Generate the slide deck based on the template specified
196
  if len(json_str) > 0:
 
237
  f' Try doing it again or try again later.\n'
238
  f' Error message: {ex}')
239
 
240
+ # logging.debug(f'JSON: {json_str}')
241
 
242
  progress_bar.progress(50, text='Contents generated')
243
 
 
303
  with st.expander('Related Web references'):
304
  st.markdown('\n\n'.join(md_text_items))
305
 
306
+ logging.info('Done!')
307
+
308
  # # Avoid image generation. It costs time and an API call, so just limit to the text generation.
309
  # with st.expander('AI-generated image on the presentation topic'):
310
  # logging.info('Calling SDXL for image generation...')
global_config.py CHANGED
@@ -31,7 +31,7 @@ class GlobalConfig:
31
  HUGGINGFACEHUB_API_TOKEN = os.environ.get('HUGGINGFACEHUB_API_TOKEN', '')
32
  METAPHOR_API_KEY = os.environ.get('METAPHOR_API_KEY', '')
33
 
34
- LOG_LEVEL = 'INFO'
35
  APP_STRINGS_FILE = 'strings.json'
36
  PRELOAD_DATA_FILE = 'examples/example_02.json'
37
  SLIDES_TEMPLATE_FILE = 'langchain_templates/template_combined.txt'
 
31
  HUGGINGFACEHUB_API_TOKEN = os.environ.get('HUGGINGFACEHUB_API_TOKEN', '')
32
  METAPHOR_API_KEY = os.environ.get('METAPHOR_API_KEY', '')
33
 
34
+ LOG_LEVEL = 'DEBUG'
35
  APP_STRINGS_FILE = 'strings.json'
36
  PRELOAD_DATA_FILE = 'examples/example_02.json'
37
  SLIDES_TEMPLATE_FILE = 'langchain_templates/template_combined.txt'
llm_helper.py CHANGED
@@ -56,7 +56,7 @@ def hf_api_query(payload: dict):
56
  :return: The output from the LLM
57
  """
58
 
59
- logging.debug(f'{payload=}')
60
  response = requests.post(HF_API_URL, headers=HF_API_HEADERS, json=payload)
61
  return response.json()
62
 
@@ -92,13 +92,14 @@ def generate_slides_content(topic: str) -> str:
92
 
93
  output = output[0]['generated_text'].strip()
94
  # output = output[len(template_txt):]
95
- logging.debug(f'{output=}')
96
 
97
  json_end_idx = output.rfind('```')
98
  if json_end_idx != -1:
99
  # logging.debug(f'{json_end_idx=}')
100
  output = output[:json_end_idx]
101
 
 
 
102
  return output
103
 
104
 
 
56
  :return: The output from the LLM
57
  """
58
 
59
+ # logging.debug(f'{payload=}')
60
  response = requests.post(HF_API_URL, headers=HF_API_HEADERS, json=payload)
61
  return response.json()
62
 
 
92
 
93
  output = output[0]['generated_text'].strip()
94
  # output = output[len(template_txt):]
 
95
 
96
  json_end_idx = output.rfind('```')
97
  if json_end_idx != -1:
98
  # logging.debug(f'{json_end_idx=}')
99
  output = output[:json_end_idx]
100
 
101
+ logging.debug(f'{output=}')
102
+
103
  return output
104
 
105