JeCabrera commited on
Commit
b85b822
·
verified ·
1 Parent(s): 88f44b0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -4
app.py CHANGED
@@ -128,10 +128,15 @@ with col1:
128
 
129
  # Generate button with callback
130
  def generate_offer():
131
- has_manual_input = bool(skills or product_service) # Changed from 'and' to 'or'
132
  has_file_input = bool('uploaded_file' in locals() and uploaded_file is not None)
133
  has_image_input = bool('uploaded_image' in locals() and uploaded_image is not None)
134
 
 
 
 
 
 
135
  # Check for valid combinations
136
  valid_input = (
137
  (has_manual_input and (has_file_input or has_image_input)) or # Text + (file or image)
@@ -163,7 +168,9 @@ with col1:
163
 
164
  # Set input type
165
  if has_image_input:
166
- if has_manual_input:
 
 
167
  st.session_state.input_type = "manual_image"
168
  elif has_file_input:
169
  st.session_state.input_type = "file_image"
@@ -176,8 +183,6 @@ with col1:
176
  st.session_state.input_type = "file"
177
  elif has_manual_input:
178
  st.session_state.input_type = "manual"
179
- else:
180
- st.session_state.input_type = "file"
181
 
182
  # Store common settings
183
  st.session_state.target_audience = target_audience
 
128
 
129
  # Generate button with callback
130
  def generate_offer():
131
+ has_manual_input = bool(skills or product_service)
132
  has_file_input = bool('uploaded_file' in locals() and uploaded_file is not None)
133
  has_image_input = bool('uploaded_image' in locals() and uploaded_image is not None)
134
 
135
+ # Simplify validation - just check if we have at least one input type
136
+ if not (has_manual_input or has_file_input or has_image_input):
137
+ st.error('Por favor proporciona al menos una entrada: texto, archivo o imagen')
138
+ return
139
+
140
  # Check for valid combinations
141
  valid_input = (
142
  (has_manual_input and (has_file_input or has_image_input)) or # Text + (file or image)
 
168
 
169
  # Set input type
170
  if has_image_input:
171
+ if has_manual_input and has_file_input:
172
+ st.session_state.input_type = "all"
173
+ elif has_manual_input:
174
  st.session_state.input_type = "manual_image"
175
  elif has_file_input:
176
  st.session_state.input_type = "file_image"
 
183
  st.session_state.input_type = "file"
184
  elif has_manual_input:
185
  st.session_state.input_type = "manual"
 
 
186
 
187
  # Store common settings
188
  st.session_state.target_audience = target_audience