barunsaha commited on
Commit
0b90947
1 Parent(s): 570f813

Increase input length and fix progress bar text

Browse files
Files changed (2) hide show
  1. app.py +4 -8
  2. config.py +1 -1
app.py CHANGED
@@ -39,9 +39,8 @@ poem = st.text_area(
39
  )
40
 
41
  if st.button('Generate image'):
42
- progress_text = 'Generating image...give it a moment'
43
  progress_bar = st.progress(0, text=progress_text)
44
- progress_bar.progress(1, text=progress_text)
45
 
46
  poem = poem.strip()
47
  input_length = len(poem)
@@ -49,15 +48,12 @@ if st.button('Generate image'):
49
  if input_length > 0:
50
  print(poem)
51
 
52
- if input_length <= 5:
53
- summary = poem
54
- else:
55
- target_length = min(input_length, Config.LLM_MAX_INPUT_LENGTH)
56
- summary = generate_summary(poem[:target_length])
57
 
58
  print(f'Summary: {summary}')
59
  st.write(f'''Summary: {summary}''')
60
- progress_bar.progress(25, text='Summary generated...need a few more minutes')
61
 
62
  image = generate_image_from_text(summary)
63
  progress_bar.progress(100, text='Done!')
 
39
  )
40
 
41
  if st.button('Generate image'):
42
+ progress_text = 'Summarizing the poem...give it a moment'
43
  progress_bar = st.progress(0, text=progress_text)
 
44
 
45
  poem = poem.strip()
46
  input_length = len(poem)
 
48
  if input_length > 0:
49
  print(poem)
50
 
51
+ target_length = min(input_length, Config.LLM_MAX_INPUT_LENGTH)
52
+ summary = generate_summary(poem[:target_length])
 
 
 
53
 
54
  print(f'Summary: {summary}')
55
  st.write(f'''Summary: {summary}''')
56
+ progress_bar.progress(10, text='Generating image...need a few more minutes')
57
 
58
  image = generate_image_from_text(summary)
59
  progress_bar.progress(100, text='Done!')
config.py CHANGED
@@ -13,7 +13,7 @@ class Config:
13
  LLM_MODEL_NAME: str = 'google/flan-t5-xxl'
14
  LLM_TEMPERATURE: float = 0.5
15
  LLM_MAX_OUTPUT_LENGTH: int = 100
16
- LLM_MAX_INPUT_LENGTH: int = 512
17
 
18
  # Stable Diffusion
19
  DIFFUSION_MODEL_NAME: str = 'stabilityai/stable-diffusion-2-1'
 
13
  LLM_MODEL_NAME: str = 'google/flan-t5-xxl'
14
  LLM_TEMPERATURE: float = 0.5
15
  LLM_MAX_OUTPUT_LENGTH: int = 100
16
+ LLM_MAX_INPUT_LENGTH: int = 1000
17
 
18
  # Stable Diffusion
19
  DIFFUSION_MODEL_NAME: str = 'stabilityai/stable-diffusion-2-1'