File size: 1,157 Bytes
783515c
 
 
17c86fb
 
783515c
17c86fb
 
 
 
 
 
 
 
 
783515c
 
17c86fb
783515c
 
17c86fb
47c50bf
17c86fb
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import gradio as gr
import plotly.graph_objects as go

# Function to create a speedometer gauge
def success_rate_gauge(success_value):
    fig = go.Figure(go.Indicator(
        mode="gauge+number",
        value=success_value,
        gauge={'axis': {'range': [0, 100]},
               'bar': {'color': "green"},
               'steps': [
                   {'range': [0, 50], 'color': "red"},
                   {'range': [50, 75], 'color': "yellow"},
                   {'range': [75, 100], 'color': "green"}],
               'threshold': {'line': {'color': "black", 'width': 4}, 'thickness': 0.75, 'value': 76}}
    ))

    fig.update_layout(height=400, width=500)
    return fig

# Gradio interface
with gr.Blocks() as demo:
    gr.Markdown("## Улучшенный спидометр с вероятностью успеха")
    
    # Add a plot output widget
    plot = gr.Plot(label="Success Rate Gauge")
    
    # Function to update the plot
    def update_plot():
        return success_rate_gauge(76)
    
    # Button to trigger the update
    with gr.Row():
        plot.render(update_plot())
    
    # Launch Gradio interface
demo.launch()