File size: 1,654 Bytes
ecdf2dd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21cec98
 
 
954162b
 
ecdf2dd
6d77c84
ecdf2dd
 
 
 
 
 
 
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
import gradio as gr
from utils import *


def gap_func(demand,inventory,customer_1_proportion_percent,high_price,low_price):
    customer_1_prop = customer_1_proportion_percent / 100
    model = ModelInfo(ARRIVAL_RATE=demand,
                                                    STARTING_INVENTORY=inventory,
                                                    CUSTOMER_1_PROP=customer_1_prop,
                                                    CUSTOMER_2_PROP=1-customer_1_prop,
                                                    HIGH_PRICE=high_price,
                                                    LOW_PRICE=low_price)
    gap = gap_between_dynamic_and_static(model=model)
    dynamic = get_best_dynamic_threshold(model=model)
    dynamic_rev,inv_threshold = dynamic
    static_result= get_static_pricing(model=model)
    low_low,high_high,high_low = static_result

    return gap,dynamic_rev,inv_threshold,low_low,high_high,high_low


demo = gr.Interface(fn=gap_func, 
                    inputs=[gr.Slider(0, 30,value=1,step=1),
                            gr.Slider(0, 30,value=2,step=1),
                            gr.Slider(0, 100,value=50,step=1),
                            "number",
                            "number"], 
                    outputs=[gr.Textbox(label='Gap'),
                             gr.Textbox(label='Inventory_threshold'),
                             gr.Textbox(label='Dynamic'),
                             gr.Textbox(label='Low-Low'),
                             gr.Textbox(label='High-High'),
                             gr.Textbox(label='High-Low')])
    
if __name__ == "__main__":
    demo.launch()