Spaces:
Sleeping
Sleeping
demongodYY
commited on
Commit
·
ea4ca6d
1
Parent(s):
25b44a6
fix key
Browse files
app.py
CHANGED
|
@@ -69,10 +69,8 @@ load_dotenv()
|
|
| 69 |
|
| 70 |
demploy_model = os.getenv("AZURE_OPENAI_DEPLOYMENT_NAME_GPT4T")
|
| 71 |
api_version = os.getenv("OPENAI_API_VERSION")
|
| 72 |
-
api_key = os.getenv("
|
| 73 |
-
endpoint = os.getenv("
|
| 74 |
-
|
| 75 |
-
print(demploy_model, api_version, api_key, endpoint)
|
| 76 |
|
| 77 |
|
| 78 |
def extract_json(s):
|
|
@@ -92,10 +90,10 @@ def extract_json(s):
|
|
| 92 |
def process_text_LLM(text):
|
| 93 |
llm = AzureChatOpenAI(
|
| 94 |
temperature=0,
|
| 95 |
-
deployment_name=
|
| 96 |
-
openai_api_version=
|
| 97 |
-
azure_endpoint=
|
| 98 |
-
api_key
|
| 99 |
)
|
| 100 |
|
| 101 |
prompt = ChatPromptTemplate.from_messages(
|
|
@@ -185,13 +183,23 @@ with gr.Blocks() as demo:
|
|
| 185 |
)
|
| 186 |
|
| 187 |
with gr.Column():
|
| 188 |
-
gender = gr.Radio(
|
| 189 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 190 |
store_name = gr.Dropdown(
|
| 191 |
-
|
|
|
|
|
|
|
| 192 |
)
|
| 193 |
type = gr.Dropdown(
|
| 194 |
label="客流类型",
|
|
|
|
| 195 |
choices=[
|
| 196 |
"新用户 - 闲逛",
|
| 197 |
"新用户 - 广告引流",
|
|
@@ -200,6 +208,7 @@ with gr.Blocks() as demo:
|
|
| 200 |
],
|
| 201 |
)
|
| 202 |
duration = gr.Dropdown(
|
|
|
|
| 203 |
label="停留时长",
|
| 204 |
choices=[
|
| 205 |
"10 分钟以内",
|
|
@@ -208,27 +217,33 @@ with gr.Blocks() as demo:
|
|
| 208 |
"60 分钟以上",
|
| 209 |
],
|
| 210 |
)
|
| 211 |
-
shopping = gr.Radio(
|
|
|
|
|
|
|
| 212 |
|
| 213 |
with gr.Column():
|
| 214 |
interested = gr.CheckboxGroup(
|
| 215 |
-
label="顾客感兴趣的商品",
|
|
|
|
|
|
|
| 216 |
)
|
| 217 |
interest_levels = gr.Radio(
|
|
|
|
| 218 |
choices=[("🌟", 1), ("🌟🌟", 2), ("🌟🌟🌟", 3)],
|
| 219 |
label="感兴趣程度 (为最近选中的商品评级)",
|
| 220 |
)
|
| 221 |
tried = gr.CheckboxGroup(
|
| 222 |
-
label="用户试戴的商品", choices=["潜水表", "万年历表"]
|
| 223 |
)
|
| 224 |
final = gr.CheckboxGroup(
|
| 225 |
-
label="最终成单商品", choices=["潜水表", "万年历表"]
|
| 226 |
)
|
| 227 |
payment = gr.Radio(
|
|
|
|
| 228 |
label="支付方式",
|
| 229 |
choices=["信用卡", "支付宝", "微信", "会员预充值卡", "现金", "其它"],
|
| 230 |
)
|
| 231 |
-
feedback = gr.Textbox(label="其它沟通内容和顾客反馈")
|
| 232 |
|
| 233 |
def process_form(text):
|
| 234 |
|
|
|
|
| 69 |
|
| 70 |
demploy_model = os.getenv("AZURE_OPENAI_DEPLOYMENT_NAME_GPT4T")
|
| 71 |
api_version = os.getenv("OPENAI_API_VERSION")
|
| 72 |
+
api_key = os.getenv("AZURE_OPENAI_API_KEY")
|
| 73 |
+
endpoint = os.getenv("AZURE_OPENAI_ENDPOINT")
|
|
|
|
|
|
|
| 74 |
|
| 75 |
|
| 76 |
def extract_json(s):
|
|
|
|
| 90 |
def process_text_LLM(text):
|
| 91 |
llm = AzureChatOpenAI(
|
| 92 |
temperature=0,
|
| 93 |
+
deployment_name=demploy_model,
|
| 94 |
+
openai_api_version=api_version,
|
| 95 |
+
azure_endpoint=endpoint,
|
| 96 |
+
openai_api_key=api_key,
|
| 97 |
)
|
| 98 |
|
| 99 |
prompt = ChatPromptTemplate.from_messages(
|
|
|
|
| 183 |
)
|
| 184 |
|
| 185 |
with gr.Column():
|
| 186 |
+
gender = gr.Radio(
|
| 187 |
+
label="顾客性别",
|
| 188 |
+
choices=["男", "女"],
|
| 189 |
+
interactive=True,
|
| 190 |
+
)
|
| 191 |
+
number = gr.Number(
|
| 192 |
+
label="人数",
|
| 193 |
+
interactive=True,
|
| 194 |
+
)
|
| 195 |
store_name = gr.Dropdown(
|
| 196 |
+
interactive=True,
|
| 197 |
+
label="门店名称",
|
| 198 |
+
choices=["徐家汇店", "静安寺店", "新天地店"],
|
| 199 |
)
|
| 200 |
type = gr.Dropdown(
|
| 201 |
label="客流类型",
|
| 202 |
+
interactive=True,
|
| 203 |
choices=[
|
| 204 |
"新用户 - 闲逛",
|
| 205 |
"新用户 - 广告引流",
|
|
|
|
| 208 |
],
|
| 209 |
)
|
| 210 |
duration = gr.Dropdown(
|
| 211 |
+
interactive=True,
|
| 212 |
label="停留时长",
|
| 213 |
choices=[
|
| 214 |
"10 分钟以内",
|
|
|
|
| 217 |
"60 分钟以上",
|
| 218 |
],
|
| 219 |
)
|
| 220 |
+
shopping = gr.Radio(
|
| 221 |
+
label="是否购物", interactive=True, choices=["是", "否"]
|
| 222 |
+
)
|
| 223 |
|
| 224 |
with gr.Column():
|
| 225 |
interested = gr.CheckboxGroup(
|
| 226 |
+
label="顾客感兴趣的商品",
|
| 227 |
+
interactive=True,
|
| 228 |
+
choices=["潜水表", "万年历表"],
|
| 229 |
)
|
| 230 |
interest_levels = gr.Radio(
|
| 231 |
+
interactive=True,
|
| 232 |
choices=[("🌟", 1), ("🌟🌟", 2), ("🌟🌟🌟", 3)],
|
| 233 |
label="感兴趣程度 (为最近选中的商品评级)",
|
| 234 |
)
|
| 235 |
tried = gr.CheckboxGroup(
|
| 236 |
+
interactive=True, label="用户试戴的商品", choices=["潜水表", "万年历表"]
|
| 237 |
)
|
| 238 |
final = gr.CheckboxGroup(
|
| 239 |
+
interactive=True, label="最终成单商品", choices=["潜水表", "万年历表"]
|
| 240 |
)
|
| 241 |
payment = gr.Radio(
|
| 242 |
+
interactive=True,
|
| 243 |
label="支付方式",
|
| 244 |
choices=["信用卡", "支付宝", "微信", "会员预充值卡", "现金", "其它"],
|
| 245 |
)
|
| 246 |
+
feedback = gr.Textbox(interactive=True, label="其它沟通内容和顾客反馈")
|
| 247 |
|
| 248 |
def process_form(text):
|
| 249 |
|