randeom commited on
Commit
12b59fd
·
verified ·
1 Parent(s): bc4cee1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -28
app.py CHANGED
@@ -140,41 +140,46 @@ def main():
140
 
141
  # Generate button
142
  if st.button("Generate Waifu"):
143
- with st.spinner("Generating waifu character..."):
144
- description_prompt = format_prompt_for_description(
145
- name, hair_color, personality, outfit_style, hobbies, favorite_food, background_story,
146
- eye_color=eye_color, height=height, age=age, favorite_quote=favorite_quote, strengths=strengths,
147
- weaknesses=weaknesses, goals=goals
148
- )
149
- image_prompt = format_prompt_for_image(
150
- name, hair_color, personality, outfit_style,
151
- background_setting=background_setting, pose=pose
152
- )
153
-
154
- # Generate character description
155
- st.session_state.character_description = generate_text(description_prompt, temperature, max_new_tokens, top_p, repetition_penalty)
156
-
157
- # Generate image prompt
158
- st.session_state.image_prompt = generate_text(image_prompt, temperature, max_new_tokens, top_p, repetition_penalty)
159
-
160
- # Generate image from image prompt
161
- st.session_state.image_paths = generate_image(st.session_state.image_prompt)
162
-
163
- st.success("Waifu character generated!")
 
164
 
165
  with right_col:
166
  st.header("Generated Waifu")
167
- # Display the generated character and image prompt
168
- if st.session_state.character_description:
169
- st.subheader("Generated Waifu Character")
170
- st.write(st.session_state.character_description)
171
- if st.session_state.image_prompt:
172
- st.subheader("Image Prompt")
173
- st.write(st.session_state.image_prompt)
174
  if st.session_state.image_paths:
175
  st.subheader("Generated Image")
176
  for image_path in st.session_state.image_paths:
177
  st.image(image_path, caption="Generated Waifu Image")
178
 
 
 
 
 
 
 
 
 
 
 
179
  if __name__ == "__main__":
180
  main()
 
140
 
141
  # Generate button
142
  if st.button("Generate Waifu"):
143
+ with right_col:
144
+ with st.spinner("Generating waifu character..."):
145
+ description_prompt = format_prompt_for_description(
146
+ name, hair_color, personality, outfit_style, hobbies, favorite_food, background_story,
147
+ eye_color=eye_color, height=height, age=age, favorite_quote=favorite_quote, strengths=strengths,
148
+ weaknesses=weaknesses, goals=goals
149
+ )
150
+ image_prompt = format_prompt_for_image(
151
+ name, hair_color, personality, outfit_style,
152
+ background_setting=background_setting, pose=pose
153
+ )
154
+
155
+ # Generate character description
156
+ st.session_state.character_description = generate_text(description_prompt, temperature, max_new_tokens, top_p, repetition_penalty)
157
+
158
+ # Generate image prompt
159
+ st.session_state.image_prompt = generate_text(image_prompt, temperature, max_new_tokens, top_p, repetition_penalty)
160
+
161
+ # Generate image from image prompt
162
+ st.session_state.image_paths = generate_image(st.session_state.image_prompt)
163
+
164
+ st.success("Waifu character generated!")
165
 
166
  with right_col:
167
  st.header("Generated Waifu")
168
+ # Display the generated image
 
 
 
 
 
 
169
  if st.session_state.image_paths:
170
  st.subheader("Generated Image")
171
  for image_path in st.session_state.image_paths:
172
  st.image(image_path, caption="Generated Waifu Image")
173
 
174
+ # Display the generated image prompt
175
+ if st.session_state.image_prompt:
176
+ st.subheader("Image Prompt")
177
+ st.write(st.session_state.image_prompt)
178
+
179
+ # Display the generated character description
180
+ if st.session_state.character_description:
181
+ st.subheader("Generated Waifu Character")
182
+ st.write(st.session_state.character_description)
183
+
184
  if __name__ == "__main__":
185
  main()