Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -199,7 +199,22 @@ async def user_ask(state, chatbot1, chatbot2, textbox):
|
|
199 |
import pandas as pd
|
200 |
|
201 |
# Function to generate leaderboard data
|
|
|
202 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
203 |
def generate_leaderboard(collection):
|
204 |
rows = list(collection.find())
|
205 |
leaderboard_data = pd.DataFrame(rows, columns=['bot_name', 'elo_rating', 'games_played'])
|
@@ -300,6 +315,15 @@ with gr.Blocks() as demo:
|
|
300 |
refresh_btn = gr.Button("π Refresh Leaderboard")
|
301 |
|
302 |
refresh_btn.click(refresh_leaderboard, outputs=[leaderboard])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
303 |
|
304 |
# Launch the Gradio interface
|
305 |
if __name__ == "__main__":
|
|
|
199 |
import pandas as pd
|
200 |
|
201 |
# Function to generate leaderboard data
|
202 |
+
import requests
|
203 |
|
204 |
+
def submit_model(model_name):
|
205 |
+
discord_url = os.environ.get("DISCORD_URL")
|
206 |
+
if discord_url:
|
207 |
+
payload = {
|
208 |
+
"content": f"New model submitted: {model_name}"
|
209 |
+
}
|
210 |
+
response = requests.post(discord_url, json=payload)
|
211 |
+
if response.status_code == 204:
|
212 |
+
return "Model submitted successfully!"
|
213 |
+
else:
|
214 |
+
return "Failed to submit the model."
|
215 |
+
else:
|
216 |
+
return "Discord webhook URL not configured."
|
217 |
+
|
218 |
def generate_leaderboard(collection):
|
219 |
rows = list(collection.find())
|
220 |
leaderboard_data = pd.DataFrame(rows, columns=['bot_name', 'elo_rating', 'games_played'])
|
|
|
315 |
refresh_btn = gr.Button("π Refresh Leaderboard")
|
316 |
|
317 |
refresh_btn.click(refresh_leaderboard, outputs=[leaderboard])
|
318 |
+
|
319 |
+
with gr.Tab("π¨ Submit Model"):
|
320 |
+
gr.Markdown("## π¨ Submit a new model to be added to the chatbot arena!")
|
321 |
+
|
322 |
+
with gr.Row():
|
323 |
+
model_name_input = gr.Textbox(placeholder="Enter the model name")
|
324 |
+
submit_model_btn = gr.Button(value="Submit Model")
|
325 |
+
submit_model_btn.click(submit_model, inputs=[model_name_input], outputs=[model_name_input])
|
326 |
+
|
327 |
|
328 |
# Launch the Gradio interface
|
329 |
if __name__ == "__main__":
|