通过AI生成数据模型辅助SAP项目实施

 通过Python AI工具生成日常SAP项目中的数据模型,方便用户进行测试运算。

main · Streamlit (inscode.run)icon-default.png?t=N7T8https://works-ipo6616b48d00639142903c2864-8501.node01.inscode.run/

 

import streamlit as st

def calc_tax_price(price, tax_rate):
    return price * (1 + tax_rate)

def save_last_price(price):
    with open('last_price.txt', 'w') as f:
        f.write(str(price))

def get_last_price():
    try:
        with open('last_price.txt', 'r') as f:
            last_price = float(f.read())
            return last_price
    except:
        return 0.0

st.title('含税价模型')
st.header('输入不含税价格,计算含税价格')

# 获取上次价格
last_price = get_last_price()
if last_price > 0.0:
    st.subheader(f'上次查询的价格为 {last_price} 元')

# 输入价格和税率
price = st.number_input('请输入不含税价格(元)', value=last_price)
tax_rate = st.slider('请选择税率', 0, 100, 20)

# 计算含税价格
tax_price = calc_tax_price(price, tax_rate / 100.0)

# 保存价格
if price != last_price:
    save_last_price(price)

# 显示含税价格
st.subheader(f'含税价格为 {tax_price:.2f} 元')

Done.
Created on 10th April, 2024

SAP Python AI模型(SAP Python AI Model Catalogue):  To Be Continue...
上一篇(Previous Article): To Be Continue...
下一篇(Next Article): To Be Continue...

  • 3
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值