bparekh99 commited on
Commit
af2927a
·
verified ·
1 Parent(s): f29cd92

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -5
app.py CHANGED
@@ -4,10 +4,20 @@ import openai
4
 
5
  # Assuming customer_order_management and order_response are defined elsewhere
6
  # For demonstration purposes, let's create dummy data
7
- customer_order_management = {
8
- "ORD123": {"item": "Laptop", "status": "Shipped", "date": "2023-10-27"},
9
- "ORD456": {"item": "Keyboard", "status": "Processing", "date": "2023-10-28"},
10
- }
 
 
 
 
 
 
 
 
 
 
11
 
12
  # Hardcoded base URL for the OpenAI API
13
  openai.api_base = "https://aibe.mygreatlearning.com/openai/v1" # Replace with your actual API base URL
@@ -56,7 +66,7 @@ interface = gr.Interface(
56
  inputs=[
57
  gr.Textbox(label="Enter your query"),
58
  gr.Textbox(label="Enter your order number"),
59
- gr.Textbox(label="Enter your OpenAI API Key", type="password") # Input for API key
60
  ],
61
  outputs=gr.Textbox(label="Chatbot Response"),
62
  title="Order Management Chatbot with OpenAI",
 
4
 
5
  # Assuming customer_order_management and order_response are defined elsewhere
6
  # For demonstration purposes, let's create dummy data
7
+ import json
8
+
9
+ file_path = "customer_order_management.json"
10
+
11
+ # Open and read the JSON file
12
+ with open(file_path, "r", encoding="utf-8") as file:
13
+ data = json.load(file) # Load JSON into a Python dictionary
14
+
15
+ customer_order_management = data
16
+
17
+ # customer_order_management = {
18
+ # "ORD123": {"item": "Laptop", "status": "Shipped", "date": "2023-10-27"},
19
+ # "ORD456": {"item": "Keyboard", "status": "Processing", "date": "2023-10-28"},
20
+ # }
21
 
22
  # Hardcoded base URL for the OpenAI API
23
  openai.api_base = "https://aibe.mygreatlearning.com/openai/v1" # Replace with your actual API base URL
 
66
  inputs=[
67
  gr.Textbox(label="Enter your query"),
68
  gr.Textbox(label="Enter your order number"),
69
+ # gr.Textbox(label="Enter your OpenAI API Key", type="password") # Input for API key
70
  ],
71
  outputs=gr.Textbox(label="Chatbot Response"),
72
  title="Order Management Chatbot with OpenAI",