Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| import TWS_fonctions | |
| import os | |
| thecss=""" | |
| .gradio-container { | |
| background-image: url('/gradio_api/file/logo.png'); | |
| background: url('/gradio_api/file/logo.png'); /* Fallback for older browsers/consistency */ | |
| background-size: cover; | |
| background-position: center; | |
| background-repeat: no-repeat; | |
| background-attachment: fixed; | |
| color: white!important; | |
| background-color: green; /* Fallback color */ | |
| } | |
| .gradio-container h1 { | |
| font-size: 36px !important;color: white!important; | |
| } | |
| .gradio-container button { | |
| font-size: 12px !important;color: white!important;font-weight: bold!important; | |
| } | |
| .gradio-container p { | |
| font-size: 18px !important;color: white!important; | |
| } | |
| #title {font-size: 36px !important;color:white !important;} | |
| #title-button {font-size: 36px !important;color:white !important;} | |
| .title {font-size: 36px !important;color:white !important;} | |
| #description {font-size: 36px !important;color:white !important;} | |
| #description-button {font-size: 36px !important;color:white !important;} | |
| .description {font-size: 36px !important;color:white !important;} | |
| #texte {font-size: 36px !important;color:white !important;} | |
| #texte-button {font-size: 36px !important;color:white !important;} | |
| .texte {font-size: 36px !important;color:white !important;} | |
| /* Styles pour le texte Markdown */ | |
| .gradio-container .gradio-description { | |
| color: white!important; /* Applique le blanc à tout le contenu du Markdown */ | |
| } | |
| .gradio-container .gradio-markdown h1, | |
| .gradio-container .gradio-markdown h2, | |
| .gradio-container .gradio-markdown h3, | |
| .gradio-container .gradio-markdown h4, | |
| .gradio-container .gradio-markdown p, | |
| .gradio-container .gradio-markdown li, | |
| .gradio-container .gradio-markdown strong { | |
| color: white !important; | |
| } | |
| /* Si vos images Markdown sont trop grandes, vous pouvez les redimensionner */ | |
| .gradio-container .gradio-markdown img { | |
| max-width: 100%; /* Empêche les images de déborder */ | |
| height: auto; | |
| display: block; /* Pour centrer si besoin */ | |
| margin: 0 auto; /* Pour centrer l'image */ | |
| } | |
| element.style { | |
| color: white!important; | |
| } | |
| """ | |
| #ajout bouteille(s) stockée dans la cave | |
| add_booking = gr.Interface( | |
| fn=TWS_fonctions.add_booking, | |
| inputs=gr.Textbox("book court 3 at 12h tomorrow, jean john bob jeanne", label="details"), | |
| outputs=[gr.Textbox(label="result")], | |
| title="function add_booking", | |
| description="add a booking court", | |
| api_name="add_booking", | |
| flagging_mode="never", | |
| css=thecss | |
| ) | |
| #retrait bouteille(s) stockée dans la cave | |
| remove_booking = gr.Interface( | |
| fn=TWS_fonctions.remove_booking, | |
| inputs=gr.Textbox("remove the booking court 3 at 12h", label="details"), | |
| outputs=[gr.Textbox(label="result")], | |
| title="function remove_booking", | |
| description="remove a court book", | |
| api_name="remove_booking", | |
| flagging_mode="never", | |
| css=thecss | |
| ) | |
| #get nombre de bouteille(s) stockée dans la cave | |
| list_booking = gr.Interface( | |
| fn=TWS_fonctions.list_booking, | |
| inputs=gr.Textbox("what is the court bookings?", label="details"), | |
| outputs=[gr.Textbox(label="result")], | |
| title="function list_booking", | |
| description="list court book", | |
| api_name="list_booking", | |
| flagging_mode="never", | |
| css=thecss | |
| ) | |
| #reset cellar | |
| booking_reset = gr.Interface( | |
| fn=TWS_fonctions.booking_reset, | |
| inputs=[], | |
| outputs=[gr.Textbox(label="result")], | |
| title="function booking_reset", | |
| description="reset the bookings", | |
| api_name="booking_reset", | |
| flagging_mode="never", | |
| css=thecss | |
| ) | |
| #search info on a bottle with image | |
| get_search_padel = gr.Interface( | |
| fn=TWS_fonctions.get_search_padel, | |
| inputs=[gr.Textbox("quelles sont les regles d'interruptions en cours de partie", label="details")], | |
| outputs=[gr.Textbox(label="result")], | |
| title="function get_search_padel", | |
| description="get search padel", | |
| api_name="get_search_padel", | |
| flagging_mode="never", | |
| css=thecss | |
| ) | |
| demo = gr.Blocks(css=thecss) | |
| with demo: | |
| gr.Markdown( | |
| """ | |
| # <h1 style='color:white;'> 🎾 World's first AI padel booking & advisor | |
| </h1> | |
| """) | |
| gr.TabbedInterface( | |
| [add_booking, remove_booking, list_booking, booking_reset,get_search_padel], | |
| ["book a court", "Remove a court book", "list court book", "bookings reset","get_search_padel"] | |
| ) | |
| gr.TabItem("Usage in Clients", elem_id="texte", elem_classes="texte" ) | |
| gr.Markdown( | |
| "<h1 style='color:white;'>To add this MCP to clients that support SSE (eg. Cursor, Windsurf, Cline), add the following to your MCP Config</h1>" | |
| ) | |
| gr.Code( | |
| """{ | |
| "mcpServers": { | |
| "ThePadelito": { | |
| "url": "https://obaes-ThePadelito.hf.space/gradio_api/mcp/sse" | |
| } | |
| } | |
| }""" | |
| ) | |
| gr.Markdown( | |
| "<h1 style='color:white;'>*Experimental stdio support* : For clients that only support stdio (eg. Claude Desktop), first install node.js. Then, you can use the following in your MCP Config</h1>" | |
| ) | |
| gr.Code( | |
| """{ | |
| "mcpServers": { | |
| "ThePadelito": { | |
| "command": "npx", | |
| "args": [ | |
| "mcp-remote", | |
| "https://obaes-ThePadelito.hf.space/gradio_api/mcp/sse", | |
| "--transport", | |
| "sse-only" | |
| ] | |
| } | |
| } | |
| }""" | |
| ) | |
| gr.Markdown( | |
| """<h1 style='color:white;'>Want to use it in your Claude Desktop? Add this to your **claude_desktop_config.json**</h1>""" | |
| ) | |
| gr.Code( | |
| """{ | |
| "mcpServers": { | |
| "ThePadelito": { | |
| "command": "npx", | |
| "args": [ | |
| "mcp-remote", | |
| "https://obaes-ThePadelito.hf.space/gradio_api/mcp/sse", | |
| "--transport", | |
| "sse-only" | |
| ] | |
| } | |
| } | |
| }""" | |
| ) | |
| gr.HTML( | |
| """ | |
| <video width="1000" controls > | |
| <source src="https://youtu.be/" type="video/mp4"> | |
| </video> | |
| """ | |
| ) | |
| gr.Markdown( | |
| """## | |
| <h1 style='color:white;'> ### Built from the ground up by olivier baes — 🎾 World's first AI padel booking & advisor | |
| Use via API or MCP 🚀 · Powered by HF, SambaNova, Mistral, OpenAi, Agno, RAG with reasonning, Cohere, Gemini, Render, PostgreSQL · Built with Gradio 🟧</h1> | |
| """ | |
| ) | |
| gr.Markdown( | |
| """ | |
| # <h1 style='color:white;'>🎾 World's first AI padel booking & advisor</h1> | |
|  | |
| """) | |
| if __name__ == "__main__": | |
| demo.launch(mcp_server=True,server_name="0.0.0.0",allowed_paths=["/"]) | |