Spaces:
Sleeping
Sleeping
Commit
·
50fac90
1
Parent(s):
b524841
Update app.py to enhance the UI by adding a unique key to the "Generate Email" button and refining the text area update logic. This change improves the handling of UI components and ensures better management of state during email generation, contributing to a smoother user experience.
Browse files
app.py
CHANGED
@@ -180,7 +180,7 @@ def update_ui(message, cv_file, cv_sections):
|
|
180 |
email_placeholder = st.empty()
|
181 |
|
182 |
# Generate button
|
183 |
-
if st.button("Generate Email"):
|
184 |
if message and cv_file and isinstance(cv_sections, dict):
|
185 |
email_text = ""
|
186 |
# Stream the response
|
@@ -188,12 +188,11 @@ def update_ui(message, cv_file, cv_sections):
|
|
188 |
for chunk in conversation_predict(message, cv_sections):
|
189 |
if chunk:
|
190 |
email_text += chunk
|
191 |
-
# Update the text area with each chunk
|
192 |
email_placeholder.text_area(
|
193 |
"Generated Email",
|
194 |
value=email_text,
|
195 |
-
height=400
|
196 |
-
key="email_output"
|
197 |
)
|
198 |
except Exception as e:
|
199 |
st.error(f"Error during email generation: {str(e)}")
|
|
|
180 |
email_placeholder = st.empty()
|
181 |
|
182 |
# Generate button
|
183 |
+
if st.button("Generate Email", key="generate_button"):
|
184 |
if message and cv_file and isinstance(cv_sections, dict):
|
185 |
email_text = ""
|
186 |
# Stream the response
|
|
|
188 |
for chunk in conversation_predict(message, cv_sections):
|
189 |
if chunk:
|
190 |
email_text += chunk
|
191 |
+
# Update the text area with each chunk, using timestamp in key
|
192 |
email_placeholder.text_area(
|
193 |
"Generated Email",
|
194 |
value=email_text,
|
195 |
+
height=400
|
|
|
196 |
)
|
197 |
except Exception as e:
|
198 |
st.error(f"Error during email generation: {str(e)}")
|