JeCabrera commited on
Commit
ba10dda
verified
1 Parent(s): c3a5730

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -18
app.py CHANGED
@@ -118,30 +118,17 @@ with col1:
118
 
119
  def generate_offer():
120
  has_manual_input = bool(skills or product_service)
121
- has_file_input = bool('uploaded_file' in locals() and uploaded_file is not None)
122
- has_image_input = bool('uploaded_image' in locals() and uploaded_image is not None)
123
 
 
124
  if not (has_manual_input or has_file_input or has_image_input):
125
- st.error('Por favor proporciona al menos una entrada: texto, archivo o imagen')
126
- return
127
-
128
- valid_input = (
129
- (has_manual_input and (has_file_input or has_image_input)) or
130
- (not has_manual_input and (has_file_input or has_image_input)) or
131
- has_file_input or
132
- has_image_input
133
- )
134
-
135
- if not valid_input:
136
- st.error('Por favor ingresa una combinaci贸n v谩lida:\n' +
137
- '- Texto + (archivo o imagen)\n' +
138
- '- Solo archivo o imagen\n' +
139
- '- Solo archivo\n' +
140
- '- Solo imagen')
141
  return
142
 
143
  st.session_state.submitted = True
144
 
 
145
  if has_manual_input:
146
  st.session_state.skills = skills if skills else ""
147
  st.session_state.product_service = product_service if product_service else ""
@@ -152,6 +139,7 @@ with col1:
152
  if has_image_input:
153
  st.session_state.image_parts = image_parts
154
 
 
155
  if has_image_input:
156
  if has_manual_input and has_file_input:
157
  st.session_state.input_type = "all"
@@ -169,6 +157,7 @@ with col1:
169
  elif has_manual_input:
170
  st.session_state.input_type = "manual"
171
 
 
172
  st.session_state.target_audience = target_audience
173
  st.session_state.temperature = temperature
174
  st.session_state.formula_type = formula_type
 
118
 
119
  def generate_offer():
120
  has_manual_input = bool(skills or product_service)
121
+ has_file_input = bool(uploaded_file is not None)
122
+ has_image_input = bool(uploaded_image is not None)
123
 
124
+ # Simple validation - check if we have at least one input type
125
  if not (has_manual_input or has_file_input or has_image_input):
126
+ st.error('Por favor ingresa texto, sube un archivo o una imagen')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
127
  return
128
 
129
  st.session_state.submitted = True
130
 
131
+ # Store inputs based on what's available
132
  if has_manual_input:
133
  st.session_state.skills = skills if skills else ""
134
  st.session_state.product_service = product_service if product_service else ""
 
139
  if has_image_input:
140
  st.session_state.image_parts = image_parts
141
 
142
+ # Set input type based on what's available
143
  if has_image_input:
144
  if has_manual_input and has_file_input:
145
  st.session_state.input_type = "all"
 
157
  elif has_manual_input:
158
  st.session_state.input_type = "manual"
159
 
160
+ # Store common settings
161
  st.session_state.target_audience = target_audience
162
  st.session_state.temperature = temperature
163
  st.session_state.formula_type = formula_type