Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,7 +3,7 @@ import requests
|
|
| 3 |
|
| 4 |
# Azure OpenAI Configuration
|
| 5 |
OPENAI_ENDPOINT = "https://rag-openai-service-ak.openai.azure.com/"
|
| 6 |
-
OPENAI_KEY = "
|
| 7 |
DEPLOYMENT_ID = "gpt-4-rag-ak"
|
| 8 |
|
| 9 |
# Function to Call Azure OpenAI API
|
|
@@ -32,11 +32,23 @@ def get_predefined_questions():
|
|
| 32 |
"What is the scope of AI in engineering?",
|
| 33 |
"What are the key highlights of the Master of Engineering Handbook?",
|
| 34 |
"How to start a career in AI?",
|
| 35 |
-
"
|
| 36 |
]
|
| 37 |
|
| 38 |
# Function to Process Query
|
| 39 |
def process_query(question):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
return call_openai_api(question)
|
| 41 |
|
| 42 |
# Gradio UI
|
|
|
|
| 3 |
|
| 4 |
# Azure OpenAI Configuration
|
| 5 |
OPENAI_ENDPOINT = "https://rag-openai-service-ak.openai.azure.com/"
|
| 6 |
+
OPENAI_KEY = "B1XyCaz87o456EVD949oODcGC8KTAEQsNLI7Yq5cnYKk41SMY9PtJQQJ99AKACHYHv6XJ3w3AAABACOGHD3K"
|
| 7 |
DEPLOYMENT_ID = "gpt-4-rag-ak"
|
| 8 |
|
| 9 |
# Function to Call Azure OpenAI API
|
|
|
|
| 32 |
"What is the scope of AI in engineering?",
|
| 33 |
"What are the key highlights of the Master of Engineering Handbook?",
|
| 34 |
"How to start a career in AI?",
|
| 35 |
+
"When will the CPT start date?",
|
| 36 |
]
|
| 37 |
|
| 38 |
# Function to Process Query
|
| 39 |
def process_query(question):
|
| 40 |
+
predefined_responses = {
|
| 41 |
+
"What are the career opportunities in AI?": "AI offers diverse opportunities in data science, machine learning engineering, robotics, and more.",
|
| 42 |
+
"What is the scope of AI in engineering?": "AI in engineering includes predictive maintenance, process optimization, and smart systems.",
|
| 43 |
+
"What are the key highlights of the Master of Engineering Handbook?": "The handbook highlights program structure, course requirements, and career support for MEng students.",
|
| 44 |
+
"How to start a career in AI?": "Starting a career in AI involves learning programming, data science, and machine learning frameworks.",
|
| 45 |
+
"When will the CPT start date?": "The CPT start date depends on the university's policy, typically after completing two full semesters. Please check your academic calendar or consult your university's DSO for accurate information.",
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
if question in predefined_responses:
|
| 49 |
+
return predefined_responses[question]
|
| 50 |
+
|
| 51 |
+
# Use Azure OpenAI for unlisted questions
|
| 52 |
return call_openai_api(question)
|
| 53 |
|
| 54 |
# Gradio UI
|