Spaces:
Sleeping
Sleeping
File size: 1,429 Bytes
783515c f154467 783515c f154467 783515c 17c86fb f154467 783515c f154467 783515c f154467 47c50bf 17c86fb cbd104c f154467 17c86fb f154467 cbd104c 783515c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
import plotly.graph_objects as go
import gradio as gr
def create_gauge():
fig = go.Figure(go.Indicator(
mode="gauge+number",
value=76,
gauge={
'axis': {'range': [0, 100]},
'bar': {'color': "black"}, # Цвет стрелки
'steps': [
{'range': [0, 40], 'color': "#55efc4"}, # Мягкий зеленый
{'range': [40, 70], 'color': "#ffeaa7"}, # Желтый
{'range': [70, 100], 'color': "#ff7675"} # Мягкий красный
],
'threshold': {
'line': {'color': "black", 'width': 4},
'thickness': 0.75,
'value': 76
}
},
number={'font': {'size': 48}} # Размер шрифта числа
))
fig.update_layout(paper_bgcolor="#f8f9fa", # Цвет фона
font={'color': "#2d3436", 'family': "Arial"}) # Цвет текста
return fig
def update_plot():
return create_gauge()
with gr.Blocks() as demo:
gr.Markdown("## Улучшенный спидометр с вероятностью успеха")
with gr.Row():
plot = gr.Plot(label="Success Rate Gauge")
with gr.Row():
update_button = gr.Button("Показать спидометр")
update_button.click(fn=update_plot, inputs=[], outputs=plot)
demo.launch() |