Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -81,7 +81,7 @@ model = load_model(MODEL_PATH)
|
|
81 |
|
82 |
# Create Gradio Interface
|
83 |
with gr.Blocks(css="""
|
84 |
-
.
|
85 |
display: grid;
|
86 |
grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
|
87 |
gap: 10px;
|
@@ -96,24 +96,15 @@ with gr.Blocks(css="""
|
|
96 |
border-radius: 8px;
|
97 |
transition: all 0.3s ease;
|
98 |
}
|
99 |
-
.card-
|
100 |
-
|
101 |
-
|
102 |
-
}
|
103 |
-
.card-container img {
|
104 |
-
width: 80px;
|
105 |
-
height: 80px;
|
106 |
object-fit: contain;
|
107 |
}
|
108 |
-
.
|
109 |
background-color: #e3f2fd;
|
110 |
border-color: #2196f3;
|
111 |
}
|
112 |
-
.card-label {
|
113 |
-
font-size: 12px;
|
114 |
-
text-align: center;
|
115 |
-
margin-top: 5px;
|
116 |
-
}
|
117 |
""") as interface:
|
118 |
gr.Markdown("## Clash Royale Prediction")
|
119 |
gr.Markdown("Select 8 cards from the opponent's deck to predict the probability of winning!")
|
@@ -132,17 +123,21 @@ with gr.Blocks(css="""
|
|
132 |
current_deck.append(card_name)
|
133 |
return current_deck, f"Selected cards: {len(current_deck)}/8"
|
134 |
|
135 |
-
# Create card grid
|
136 |
-
with gr.
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
|
|
|
|
|
|
|
|
146 |
|
147 |
with gr.Row():
|
148 |
result = gr.Textbox(label="Prediction Result:", interactive=False)
|
|
|
81 |
|
82 |
# Create Gradio Interface
|
83 |
with gr.Blocks(css="""
|
84 |
+
.container {
|
85 |
display: grid;
|
86 |
grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
|
87 |
gap: 10px;
|
|
|
96 |
border-radius: 8px;
|
97 |
transition: all 0.3s ease;
|
98 |
}
|
99 |
+
img.card-image {
|
100 |
+
width: 80px !important;
|
101 |
+
height: 80px !important;
|
|
|
|
|
|
|
|
|
102 |
object-fit: contain;
|
103 |
}
|
104 |
+
.selected {
|
105 |
background-color: #e3f2fd;
|
106 |
border-color: #2196f3;
|
107 |
}
|
|
|
|
|
|
|
|
|
|
|
108 |
""") as interface:
|
109 |
gr.Markdown("## Clash Royale Prediction")
|
110 |
gr.Markdown("Select 8 cards from the opponent's deck to predict the probability of winning!")
|
|
|
123 |
current_deck.append(card_name)
|
124 |
return current_deck, f"Selected cards: {len(current_deck)}/8"
|
125 |
|
126 |
+
# Create card grid using rows and columns
|
127 |
+
with gr.Column():
|
128 |
+
cards_per_row = 8
|
129 |
+
cards_list = list(valid_card_images.items())
|
130 |
+
|
131 |
+
for i in range(0, len(cards_list), cards_per_row):
|
132 |
+
with gr.Row():
|
133 |
+
for card, url in cards_list[i:i + cards_per_row]:
|
134 |
+
with gr.Column():
|
135 |
+
btn = gr.Button(image=url, label=card)
|
136 |
+
btn.click(
|
137 |
+
toggle_card,
|
138 |
+
inputs=[gr.Textbox(value=card, visible=False), selected_deck],
|
139 |
+
outputs=[selected_deck, selected_cards_display]
|
140 |
+
)
|
141 |
|
142 |
with gr.Row():
|
143 |
result = gr.Textbox(label="Prediction Result:", interactive=False)
|