openfree commited on
Commit
9a2e3f1
ยท
verified ยท
1 Parent(s): da37e9a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -3
app.py CHANGED
@@ -144,6 +144,8 @@ def get_reading(question, selected_cards):
144
  return result + "\n\n๐ŸŒŸ May these insights guide your path! ๐ŸŒŸ"
145
 
146
 
 
 
147
  demo = gr.Interface(
148
  fn=get_reading,
149
  inputs=[
@@ -152,11 +154,10 @@ demo = gr.Interface(
152
  placeholder="Enter your question here...",
153
  lines=3
154
  ),
155
- gr.Checkboxgroup(
156
  choices=list(tarot_cards.keys()),
157
  label="๐ŸŽด Select Your Cards (Max 5)",
158
- info="Choose 1-5 cards for your reading",
159
- max_choices=5
160
  )
161
  ],
162
  outputs=gr.Textbox(
@@ -210,6 +211,19 @@ demo = gr.Interface(
210
  """
211
  )
212
 
 
 
 
 
 
 
 
 
 
 
 
 
 
213
 
214
  # Example questions
215
  examples = [
 
144
  return result + "\n\n๐ŸŒŸ May these insights guide your path! ๐ŸŒŸ"
145
 
146
 
147
+ # ... (์ด์ „ ์ฝ”๋“œ๋Š” ๋™์ผ)
148
+
149
  demo = gr.Interface(
150
  fn=get_reading,
151
  inputs=[
 
154
  placeholder="Enter your question here...",
155
  lines=3
156
  ),
157
+ gr.CheckboxGroup( # CheckboxGroup์œผ๋กœ ์ˆ˜์ •
158
  choices=list(tarot_cards.keys()),
159
  label="๐ŸŽด Select Your Cards (Max 5)",
160
+ info="Choose 1-5 cards for your reading"
 
161
  )
162
  ],
163
  outputs=gr.Textbox(
 
211
  """
212
  )
213
 
214
+ # ์นด๋“œ ์„ ํƒ ์ œํ•œ์„ ์œ„ํ•œ ํ•จ์ˆ˜ ์ˆ˜์ •
215
+ def validate_selection(selected_cards):
216
+ if len(selected_cards) > 5:
217
+ return selected_cards[:5]
218
+ return selected_cards
219
+
220
+ demo.input_components[1].change(
221
+ fn=validate_selection,
222
+ inputs=[demo.input_components[1]],
223
+ outputs=[demo.input_components[1]]
224
+ )
225
+
226
+
227
 
228
  # Example questions
229
  examples = [