Spaces:
Sleeping
Sleeping
Download app.py from Robocp/defi-dashboard: direct link, hf CLI and curl.
- Browser
- Download file 955 Bytes
-
https://huggingface.co/spaces/Robocp/defi-dashboard/resolve/main/app.py
- Command line
-
hf download hf://spaces/Robocp/defi-dashboard/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Robocp/defi-dashboard/resolve/main/app.py
955 Bytes
| import gradio as gr | |
| import random | |
| # Simula莽茫o de dados DeFi (em um caso real, puxar铆amos de APIs como DefiLlama, Uniswap, Raydium, etc.) | |
| def get_portfolio_value(wallet: str): | |
| fake_tokens = { | |
| "SOL": round(random.uniform(100, 200), 2), | |
| "USDC": round(random.uniform(500, 700), 2), | |
| "BTC": round(random.uniform(25000, 30000), 2) | |
| } | |
| total = sum(fake_tokens.values()) | |
| report = f"馃搳 Relat贸rio da carteira: {wallet}\n\n" | |
| for token, value in fake_tokens.items(): | |
| report += f"- {token}: ${value}\n" | |
| report += f"\n馃挵 Valor Total: ${total}" | |
| return report | |
| with gr.Blocks() as demo: | |
| gr.Markdown("## 馃寪 DeFi Dashboard (vers茫o demo)") | |
| wallet_input = gr.Textbox(label="Digite o endere莽o da sua carteira") | |
| output = gr.Textbox(label="Relat贸rio DeFi") | |
| run_btn = gr.Button("Gerar Relat贸rio") | |
| run_btn.click(fn=get_portfolio_value, inputs=wallet_input, outputs=output) | |
| demo.launch() | |