Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -200,23 +200,39 @@ with col2:
|
|
| 200 |
# Usar la funci贸n actualizada
|
| 201 |
# In the generate_offer function or wherever the error is occurring
|
| 202 |
# The function definition needs proper indentation for its body
|
|
|
|
| 203 |
def generate_offer():
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 220 |
|
| 221 |
# Add additional context based on input type
|
| 222 |
if st.session_state.input_type == "manual":
|
|
|
|
| 200 |
# Usar la funci贸n actualizada
|
| 201 |
# In the generate_offer function or wherever the error is occurring
|
| 202 |
# The function definition needs proper indentation for its body
|
| 203 |
+
# Where you're generating the offer
|
| 204 |
def generate_offer():
|
| 205 |
+
# Get necessary variables
|
| 206 |
+
selected_formula_name = st.session_state.formula_type
|
| 207 |
+
avatar_description = st.session_state.target_audience
|
| 208 |
+
product_name = st.session_state.product_service
|
| 209 |
+
|
| 210 |
+
# Create the base instruction
|
| 211 |
+
instruction = create_offer_instruction(
|
| 212 |
+
avatar_description=avatar_description,
|
| 213 |
+
product_name=product_name,
|
| 214 |
+
selected_formula_name=selected_formula_name,
|
| 215 |
+
offer_formulas=offer_formulas
|
| 216 |
+
)
|
| 217 |
+
|
| 218 |
+
# If you have additional context to add
|
| 219 |
+
additional_context = ""
|
| 220 |
+
|
| 221 |
+
# Add file content if available
|
| 222 |
+
if st.session_state.input_type in ["file", "both"]:
|
| 223 |
+
additional_context = f"\n\nAdditional context from uploaded file:\n{st.session_state.file_content}"
|
| 224 |
+
|
| 225 |
+
# Now add the additional context to the instruction
|
| 226 |
+
if additional_context:
|
| 227 |
+
instruction += additional_context
|
| 228 |
+
|
| 229 |
+
# Generate the response
|
| 230 |
+
response = model.generate_content(instruction)
|
| 231 |
+
offer_result = response.text
|
| 232 |
+
|
| 233 |
+
# Update session state
|
| 234 |
+
st.session_state.offer_result = offer_result
|
| 235 |
+
st.session_state.generated = True
|
| 236 |
|
| 237 |
# Add additional context based on input type
|
| 238 |
if st.session_state.input_type == "manual":
|