Marvin Timm commited on
Delete jan_lukas.py
Browse files- jan_lukas.py +0 -377
jan_lukas.py
DELETED
|
@@ -1,377 +0,0 @@
|
|
| 1 |
-
import gradio as gr
|
| 2 |
-
import pandas as pd
|
| 3 |
-
from sentence_transformers import SentenceTransformer
|
| 4 |
-
import chromadb
|
| 5 |
-
import openai
|
| 6 |
-
from dotenv import load_dotenv
|
| 7 |
-
import os
|
| 8 |
-
import json
|
| 9 |
-
from pathlib import Path
|
| 10 |
-
|
| 11 |
-
load_dotenv()
|
| 12 |
-
openai.api_key = os.getenv('OPENAI_API_KEY')
|
| 13 |
-
# openai.api_key = "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"
|
| 14 |
-
if not openai.api_key:
|
| 15 |
-
raise ValueError("Bitte setze die Umgebungsvariable 'OPENAI_API_KEY' mit deinem OpenAI API-Schlüssel.")
|
| 16 |
-
|
| 17 |
-
model = SentenceTransformer('all-MiniLM-L6-v2')
|
| 18 |
-
|
| 19 |
-
try:
|
| 20 |
-
df = pd.read_csv('transcripts_cleaned.csv', sep=';')
|
| 21 |
-
except FileNotFoundError:
|
| 22 |
-
raise FileNotFoundError("Die Datei 'transcripts_cleaned.csv' wurde nicht gefunden. Bitte stelle sicher, dass sie im selben Verzeichnis wie dieses Skript liegt.")
|
| 23 |
-
|
| 24 |
-
df['answer_embedding'] = df['answer'].apply(lambda x: model.encode(x).tolist())
|
| 25 |
-
|
| 26 |
-
client = chromadb.PersistentClient(path="chroma_db")
|
| 27 |
-
|
| 28 |
-
collection_name = "supply_chain_recommendations_2"
|
| 29 |
-
if collection_name in [col.name for col in client.list_collections()]:
|
| 30 |
-
collection = client.get_collection(collection_name)
|
| 31 |
-
else:
|
| 32 |
-
collection = client.create_collection(collection_name)
|
| 33 |
-
collection.add(
|
| 34 |
-
documents=df['answer'].tolist(),
|
| 35 |
-
embeddings=df['answer_embedding'].tolist(),
|
| 36 |
-
ids=df.index.astype(str).tolist()
|
| 37 |
-
)
|
| 38 |
-
|
| 39 |
-
system_prompt="""
|
| 40 |
-
You are an AI specialized in Supply Chain 4.0 (SC4.0) and Industry 4.0 (I4.0) technologies.
|
| 41 |
-
Your task is to analyze user-provided interview responses and generate actionable,
|
| 42 |
-
evidence-based recommendations for the following research questions. Your analysis must
|
| 43 |
-
incorporate the Dynamic Capabilities Framework, ensuring that responses address how
|
| 44 |
-
organizations can sense opportunities, seize them, and transform operations to adapt and
|
| 45 |
-
succeed.
|
| 46 |
-
-Which I4.0 technologies should combine in the supply chain of the user?
|
| 47 |
-
-What prerequisites must be met to ensure these technologies are successfully
|
| 48 |
-
implemented?
|
| 49 |
-
–What is the optimal sequence for implementing these technologies?
|
| 50 |
-
This is your Output Layout:
|
| 51 |
-
“Thank you for using the Supply Chain 4.0 Recommender.
|
| 52 |
-
The first section of the recommendation provides recommendations on how to improve the
|
| 53 |
-
dynamic capabilities of your company. The second section covers potential Industry 4.0
|
| 54 |
-
technology bundles for your supply chain and the prerequisites for their implementation, as
|
| 55 |
-
well as a recommendation for the optimal sequencing of these technologies. The third
|
| 56 |
-
section of the recommendation provides a step-by-step guide to implementing the
|
| 57 |
-
recommendations.”
|
| 58 |
-
1.Give recommendations on how to improve each Dynamic Capability element (Sensing,
|
| 59 |
-
Seizing, Transforming, Resources&Capabilities).
|
| 60 |
-
2. Provide answers to the three questions (Which I4.0 technologies should be combined in
|
| 61 |
-
the user's supply chain?
|
| 62 |
-
-What are the prerequisites for the successful implementation of these technologies?
|
| 63 |
-
-What is the optimal sequence for implementing these technologies?)
|
| 64 |
-
3. At the end of your answer, give a step-by-step guide on how to get started from the
|
| 65 |
-
current development point of the company.
|
| 66 |
-
“Please be advised that no liability is accepted for the success of the recommendations
|
| 67 |
-
provided. These should be regarded as suggestions only.”
|
| 68 |
-
|
| 69 |
-
Additional Notes:
|
| 70 |
-
Use the Dynamic Capabilities Framework as a lens to ensure recommendations focus on how
|
| 71 |
-
organizations adapt, innovate, and thrive.
|
| 72 |
-
Integrate user-provided insights with industry best practices for SC4.0.
|
| 73 |
-
Deliver clear, actionable, and practical guidance tailored for supply chain leaders and
|
| 74 |
-
technology decision-makers.
|
| 75 |
-
Tone & Style: Professional, evidence-based, and concise, suitable for a technical and
|
| 76 |
-
strategic audience.
|
| 77 |
-
|
| 78 |
-
Dynamic Capabilities Framework
|
| 79 |
-
Sensing
|
| 80 |
-
Definition: The organizations ability to detect opportunities and threats in its internal and
|
| 81 |
-
external environment.
|
| 82 |
-
Scope: This involves scanning, monitoring, and assessing technological developments,
|
| 83 |
-
customer needs, and market responses.
|
| 84 |
-
Examples: Conducting systematic market research, Identifying new trends and technologies,
|
| 85 |
-
Recognizing weaknesses and areas for improvement within the organization.
|
| 86 |
-
Seizing
|
| 87 |
-
Definition: The ability to capitalize on identified opportunities to create value.
|
| 88 |
-
Scope: Mobilizing resources to address opportunities and mitigate threats effectively.
|
| 89 |
-
Examples: Strategic investments in new technologies, Developing new business models,
|
| 90 |
-
Making decisions based on a comprehensive evaluation of internal strengths and
|
| 91 |
-
weaknesses.
|
| 92 |
-
Transforming
|
| 93 |
-
Definition: The ability to continuously renew the organization to adapt to change and enable
|
| 94 |
-
growth.
|
| 95 |
-
Scope: Reconfiguring structures, processes, and resources to achieve strategic goals and
|
| 96 |
-
avoid path dependencies.
|
| 97 |
-
Examples: Implementing new processes or products, Training and upskilling employees,
|
| 98 |
-
redesigning organizational structures to improve efficiency.
|
| 99 |
-
Resources and Capabilities
|
| 100 |
-
These form the foundation for the three capacities above. Resources include physical,
|
| 101 |
-
human, and technological assets, while capabilities refer to the organizational processes that
|
| 102 |
-
enable the effective use and combination of these resources.
|
| 103 |
-
"""
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
# Path to feedback JSON file
|
| 107 |
-
FEEDBACK_FILE = 'feedback.json'
|
| 108 |
-
|
| 109 |
-
def get_recommendations(user_query,
|
| 110 |
-
company_location,
|
| 111 |
-
industry,
|
| 112 |
-
suppliers_customers,
|
| 113 |
-
customers_count,
|
| 114 |
-
existing_tech,
|
| 115 |
-
use_tech_company,
|
| 116 |
-
characteristics_improved,
|
| 117 |
-
characteristics_to_improve,
|
| 118 |
-
best_practices_knowledge,
|
| 119 |
-
up_to_date_info,
|
| 120 |
-
systematic_information_collection,
|
| 121 |
-
easy_information_obtain,
|
| 122 |
-
closely_follow_competitors,
|
| 123 |
-
quickly_notice_changes,
|
| 124 |
-
quickly_recognize_potential,
|
| 125 |
-
recognize_new_approaches,
|
| 126 |
-
translate_information,
|
| 127 |
-
successfully_use_information,
|
| 128 |
-
well_prepared_processes,
|
| 129 |
-
successfully_implement_changes,
|
| 130 |
-
successful_intro_in_past,
|
| 131 |
-
clarity_responsibilities_roles,
|
| 132 |
-
change_projects_parallel,
|
| 133 |
-
flexibly_adapt_change_plans,
|
| 134 |
-
available_resources,
|
| 135 |
-
digital_skills,
|
| 136 |
-
technological_infrastructure_preparedness,
|
| 137 |
-
flexible_financial_resources,
|
| 138 |
-
supply_chain_partners_involvement,
|
| 139 |
-
biggest_challenges,
|
| 140 |
-
selection_criteria,
|
| 141 |
-
top_k=5):
|
| 142 |
-
survey_responses = {
|
| 143 |
-
"Where is your company located?": company_location,
|
| 144 |
-
"Which industry does your company belong to?": industry,
|
| 145 |
-
"How many suppliers and customers does your company have?": suppliers_customers,
|
| 146 |
-
"How many customers does your company have?": customers_count,
|
| 147 |
-
"Which Industry 4.0 technologies do you already use in your supply chain?": existing_tech,
|
| 148 |
-
"Do you use bundles of Industry 4.0 technologies? If so, which ones?": use_tech_company,
|
| 149 |
-
"Which characteristics of your supply chain have been improved by I4.0 technologies?": characteristics_improved,
|
| 150 |
-
"What characteristics of your supply chain need to be improved in the future?": characteristics_to_improve,
|
| 151 |
-
"How well does your company know best practices for digitalisation in the supply chain?": best_practices_knowledge,
|
| 152 |
-
"How up-to-date is your company informed about new I4.0 technologies for the supply chain?": up_to_date_info,
|
| 153 |
-
"How systematically does your company collect information about market trends and technologies for the supply chain?": systematic_information_collection,
|
| 154 |
-
"How easily can your company obtain information about innovative technologies for the supply chain?": easy_information_obtain,
|
| 155 |
-
"How closely is your company following changes with competitors that use I4.0 technologies in the supply chain?": closely_follow_competitors,
|
| 156 |
-
"How quickly does your company notice changes in the dynamics of your supply chain?": quickly_notice_changes,
|
| 157 |
-
"How quickly does your company recognise the potential of new technologies for supply chain processes?": quickly_recognize_potential,
|
| 158 |
-
"How well do you recognize how new approaches can be implemented in our company?": recognize_new_approaches,
|
| 159 |
-
"How well is your company able to translate information and impressions and apply it to your company?": translate_information,
|
| 160 |
-
"How successfully does your company use current information in the context of digitization to develop and drive change?": successfully_use_information,
|
| 161 |
-
"How well prepared are your supply chain processes to benefit from new technologies?": well_prepared_processes,
|
| 162 |
-
"How successfully does your company implement planned changes in the supply chain?": successfully_implement_changes,
|
| 163 |
-
"How successful has your company been in introducing innovative technologies in the supply chain in the past?": successful_intro_in_past,
|
| 164 |
-
"How clear are the responsibilities and roles in the introduction of I4.0 technologies in your supply chain?": clarity_responsibilities_roles,
|
| 165 |
-
"How well can change projects be carried out in your supply chain in parallel with day-to-day business?": change_projects_parallel,
|
| 166 |
-
"How well is your company able to flexibly adapt change plans to the current situation?": flexibly_adapt_change_plans,
|
| 167 |
-
"Which of the following resources are available to your organization for the digital transformation of the supply chain?": available_resources,
|
| 168 |
-
"How do you rate the digital skills of employees in your supply chain?": digital_skills,
|
| 169 |
-
"How well is the technological infrastructure of your supply chain prepared for digital transformation?": technological_infrastructure_preparedness,
|
| 170 |
-
"How flexibly can financial resources be used for transformation projects in the supply chain?": flexible_financial_resources,
|
| 171 |
-
"To what extent are your supply chain partners involved in transformation projects?": supply_chain_partners_involvement,
|
| 172 |
-
"What challenges do you see as the biggest in the introduction of I4.0 technologies in your supply chain?": biggest_challenges,
|
| 173 |
-
"What are the most important criteria for selecting and prioritizing technologies in your supply chain?": selection_criteria
|
| 174 |
-
}
|
| 175 |
-
|
| 176 |
-
query_embedding = model.encode(user_query).tolist()
|
| 177 |
-
|
| 178 |
-
results = collection.query(
|
| 179 |
-
query_embeddings=[query_embedding],
|
| 180 |
-
n_results=top_k,
|
| 181 |
-
include=["documents"]
|
| 182 |
-
)
|
| 183 |
-
|
| 184 |
-
retrieved_answers = results['documents'][0]
|
| 185 |
-
context = " ".join(retrieved_answers)
|
| 186 |
-
|
| 187 |
-
# Construct survey text
|
| 188 |
-
survey_text = "\n".join([f"{q}: {r}" for q, r in survey_responses.items()])
|
| 189 |
-
|
| 190 |
-
prompt = (
|
| 191 |
-
f"Based on the following insights from Supply Chain 4.0 leaders and the user's survey responses, provide actionable recommendations:\n\n"
|
| 192 |
-
f"Interview Insights:\n{context}\n\n"
|
| 193 |
-
f"User Survey Responses:\n{survey_text}\n\n"
|
| 194 |
-
f"Recommendations:"
|
| 195 |
-
)
|
| 196 |
-
|
| 197 |
-
try:
|
| 198 |
-
response = openai.chat.completions.create(
|
| 199 |
-
model="gpt-4o",
|
| 200 |
-
messages=[
|
| 201 |
-
{"role": "system", "content": system_prompt},
|
| 202 |
-
{"role": "user", "content": prompt}
|
| 203 |
-
],
|
| 204 |
-
)
|
| 205 |
-
|
| 206 |
-
recommendations = response.choices[0].message.content.strip()
|
| 207 |
-
except Exception as e:
|
| 208 |
-
recommendations = f"Ein Fehler ist aufgetreten: {str(e)}"
|
| 209 |
-
|
| 210 |
-
return recommendations
|
| 211 |
-
|
| 212 |
-
# Updated survey_questions with all 31 questions
|
| 213 |
-
survey_questions = {
|
| 214 |
-
"Where is your company located?": ["North America", "Europe", "Asia", "Other"],
|
| 215 |
-
"Which industry does your company belong to?": ["Manufacturing", "Retail", "Healthcare", "Logistics", "Other"],
|
| 216 |
-
"How many suppliers and customers does your company have?": ["<100", "100-500", "500-1000", ">1000"],
|
| 217 |
-
"How many customers does your company have?": ["<100", "100-500", "500-1000", ">1000"],
|
| 218 |
-
"Which Industry 4.0 technologies do you already use in your supply chain?": ["Internet of Things (IoT)", "Artificial Intelligence (AI)", "Blockchain", "Robotics", "Digital Twins", "ERP Systems", "Other"],
|
| 219 |
-
"Do you use bundles of Industry 4.0 technologies? If so, which ones?": ["IoT + AI", "Robotics + Big Data", "Blockchain + Cloud Computing", "Digital Twin + AI", "Other Combinations"],
|
| 220 |
-
"Which characteristics of your supply chain have been improved by I4.0 technologies?": ["Efficiency", "Costs", "Quality", "Flexibility", "Customer Satisfaction", "Sustainability"],
|
| 221 |
-
"What characteristics of your supply chain need to be improved in the future?": ["Efficiency", "Costs", "Quality", "Flexibility", "Customer Satisfaction", "Sustainability"],
|
| 222 |
-
"How well does your company know best practices for digitalisation in the supply chain?": ["Very good", "Good", "Sufficient", "Weak"],
|
| 223 |
-
"How up-to-date is your company informed about new I4.0 technologies for the supply chain?": ["Very current", "Current", "Partially current", "Hardly current"],
|
| 224 |
-
"How systematically does your company collect information about market trends and technologies for the supply chain?": ["Very systematic", "Rather systematic", "Little systematic", "Not at all"],
|
| 225 |
-
"How easily can your company obtain information about innovative technologies for the supply chain?": ["Very light", "Light", "With difficulty", "Hardly"],
|
| 226 |
-
"How closely is your company following changes with competitors that use I4.0 technologies in the supply chain?": ["Very attentive", "Attentive", "Partially attentive", "Hardly/not"],
|
| 227 |
-
"How quickly does your company notice changes in the dynamics of your supply chain?": ["Very fast", "Fast", "Slow", "Very slow"],
|
| 228 |
-
"How quickly does your company recognise the potential of new technologies for supply chain processes?": ["Very fast", "Fast", "Slow", "Very slow"],
|
| 229 |
-
"How well do you recognize how new approaches can be implemented in our company?": ["Very good", "Good", "Partly good", "Weak"],
|
| 230 |
-
"How well is your company able to translate information and impressions and apply it to your company?": ["Very good", "Good", "Partly good", "Weak"],
|
| 231 |
-
"How successfully does your company use current information in the context of digitization to develop and drive change?": ["Very successful", "Successful", "Partially successful", "Hardly/not"],
|
| 232 |
-
"How well prepared are your supply chain processes to benefit from new technologies?": ["Very good", "Good", "Sufficient", "Weak"],
|
| 233 |
-
"How successfully does your company implement planned changes in the supply chain?": ["Very successful", "Successful", "Partially successful", "Hardly/not"],
|
| 234 |
-
"How successful has your company been in introducing innovative technologies in the supply chain in the past?": ["Very successful", "Successful", "Partially successful", "Hardly/not"],
|
| 235 |
-
"How clear are the responsibilities and roles in the introduction of I4.0 technologies in your supply chain?": ["Very clear", "Clear", "Partially clear", "Unclear"],
|
| 236 |
-
"How well can change projects be carried out in your supply chain in parallel with day-to-day business?": ["Very good", "Good", "Partly good", "Weak"],
|
| 237 |
-
"How well is your company able to flexibly adapt change plans to the current situation?": ["Very High", "High", "Medium", "Low"],
|
| 238 |
-
"Which of the following resources are available to your organization for the digital transformation of the supply chain?": ["Sufficient budget", "Competent employees with digital know-how", "Access to external expert knowledge", "Modern IT and data infrastructure"],
|
| 239 |
-
"How do you rate the digital skills of employees in your supply chain?": ["Very high", "High", "Mediocre", "Low"],
|
| 240 |
-
"How well is the technological infrastructure of your supply chain prepared for digital transformation?": ["Very good", "Good", "Sufficient", "Weak"],
|
| 241 |
-
"How flexibly can financial resources be used for transformation projects in the supply chain?": ["Very flexible", "Flexible", "Limited flexibility", "Hardly flexible"],
|
| 242 |
-
"To what extent are your supply chain partners involved in transformation projects?": ["Very strong", "Strong", "Partly strong", "Weak"],
|
| 243 |
-
"What challenges do you see as the biggest in the introduction of I4.0 technologies in your supply chain?": ["Lack of resources", "Resistance to change", "Low integration with partners", "Technological knowledge"],
|
| 244 |
-
"What are the most important criteria for selecting and prioritizing technologies in your supply chain?": ["Costs", "Scalability", "Interoperability", "Implementation Effort"],
|
| 245 |
-
}
|
| 246 |
-
|
| 247 |
-
def create_gradio_inputs():
|
| 248 |
-
inputs = []
|
| 249 |
-
inputs.append(gr.Textbox(lines=2, placeholder="Gib hier deine Frage ein...", label="User Query"))
|
| 250 |
-
for question, options in survey_questions.items():
|
| 251 |
-
if "Which" in question or "How" in question or "Do" in question or "To" in question or "What" in question:
|
| 252 |
-
inputs.append(gr.CheckboxGroup(choices=options, label=question))
|
| 253 |
-
else:
|
| 254 |
-
inputs.append(gr.Radio(choices=options, label=question))
|
| 255 |
-
return inputs
|
| 256 |
-
|
| 257 |
-
outputs = gr.Textbox(label="Recommendations", lines=20)
|
| 258 |
-
|
| 259 |
-
def gradio_interface(user_query,
|
| 260 |
-
company_location,
|
| 261 |
-
industry,
|
| 262 |
-
suppliers_customers,
|
| 263 |
-
customers_count,
|
| 264 |
-
existing_tech,
|
| 265 |
-
use_tech_company,
|
| 266 |
-
characteristics_improved,
|
| 267 |
-
characteristics_to_improve,
|
| 268 |
-
best_practices_knowledge,
|
| 269 |
-
up_to_date_info,
|
| 270 |
-
systematic_information_collection,
|
| 271 |
-
easy_information_obtain,
|
| 272 |
-
closely_follow_competitors,
|
| 273 |
-
quickly_notice_changes,
|
| 274 |
-
quickly_recognize_potential,
|
| 275 |
-
recognize_new_approaches,
|
| 276 |
-
translate_information,
|
| 277 |
-
successfully_use_information,
|
| 278 |
-
well_prepared_processes,
|
| 279 |
-
successfully_implement_changes,
|
| 280 |
-
successful_intro_in_past,
|
| 281 |
-
clarity_responsibilities_roles,
|
| 282 |
-
change_projects_parallel,
|
| 283 |
-
flexibly_adapt_change_plans,
|
| 284 |
-
available_resources,
|
| 285 |
-
digital_skills,
|
| 286 |
-
technological_infrastructure_preparedness,
|
| 287 |
-
flexible_financial_resources,
|
| 288 |
-
supply_chain_partners_involvement,
|
| 289 |
-
biggest_challenges,
|
| 290 |
-
selection_criteria):
|
| 291 |
-
survey_responses = {
|
| 292 |
-
"Where is your company located?": company_location,
|
| 293 |
-
"Which industry does your company belong to?": industry,
|
| 294 |
-
"How many suppliers and customers does your company have?": suppliers_customers,
|
| 295 |
-
"How many customers does your company have?": customers_count,
|
| 296 |
-
"Which Industry 4.0 technologies do you already use in your supply chain?": existing_tech,
|
| 297 |
-
"Do you use bundles of Industry 4.0 technologies? If so, which ones?": use_tech_company,
|
| 298 |
-
"Which characteristics of your supply chain have been improved by I4.0 technologies?": characteristics_improved,
|
| 299 |
-
"What characteristics of your supply chain need to be improved in the future?": characteristics_to_improve,
|
| 300 |
-
"How well does your company know best practices for digitalisation in the supply chain?": best_practices_knowledge,
|
| 301 |
-
"How up-to-date is your company informed about new I4.0 technologies for the supply chain?": up_to_date_info,
|
| 302 |
-
"How systematically does your company collect information about market trends and technologies for the supply chain?": systematic_information_collection,
|
| 303 |
-
"How easily can your company obtain information about innovative technologies for the supply chain?": easy_information_obtain,
|
| 304 |
-
"How closely is your company following changes with competitors that use I4.0 technologies in the supply chain?": closely_follow_competitors,
|
| 305 |
-
"How quickly does your company notice changes in the dynamics of your supply chain?": quickly_notice_changes,
|
| 306 |
-
"How quickly does your company recognise the potential of new technologies for supply chain processes?": quickly_recognize_potential,
|
| 307 |
-
"How well do you recognize how new approaches can be implemented in our company?": recognize_new_approaches,
|
| 308 |
-
"How well is your company able to translate information and impressions and apply it to your company?": translate_information,
|
| 309 |
-
"How successfully does your company use current information in the context of digitization to develop and drive change?": successfully_use_information,
|
| 310 |
-
"How well prepared are your supply chain processes to benefit from new technologies?": well_prepared_processes,
|
| 311 |
-
"How successfully does your company implement planned changes in the supply chain?": successfully_implement_changes,
|
| 312 |
-
"How successful has your company been in introducing innovative technologies in the supply chain in the past?": successful_intro_in_past,
|
| 313 |
-
"How clear are the responsibilities and roles in the introduction of I4.0 technologies in your supply chain?": clarity_responsibilities_roles,
|
| 314 |
-
"How well can change projects be carried out in your supply chain in parallel with day-to-day business?": change_projects_parallel,
|
| 315 |
-
"How well is your company able to flexibly adapt change plans to the current situation?": flexibly_adapt_change_plans,
|
| 316 |
-
"Which of the following resources are available to your organization for the digital transformation of the supply chain?": available_resources,
|
| 317 |
-
"How do you rate the digital skills of employees in your supply chain?": digital_skills,
|
| 318 |
-
"How well is the technological infrastructure of your supply chain prepared for digital transformation?": technological_infrastructure_preparedness,
|
| 319 |
-
"How flexibly can financial resources be used for transformation projects in the supply chain?": flexible_financial_resources,
|
| 320 |
-
"To what extent are your supply chain partners involved in transformation projects?": supply_chain_partners_involvement,
|
| 321 |
-
"What challenges do you see as the biggest in the introduction of I4.0 technologies in your supply chain?": biggest_challenges,
|
| 322 |
-
"What are the most important criteria for selecting and prioritizing technologies in your supply chain?": selection_criteria
|
| 323 |
-
}
|
| 324 |
-
|
| 325 |
-
recommendations = get_recommendations(
|
| 326 |
-
user_query=user_query,
|
| 327 |
-
company_location=survey_responses["Where is your company located?"],
|
| 328 |
-
industry=survey_responses["Which industry does your company belong to?"],
|
| 329 |
-
suppliers_customers=survey_responses["How many suppliers and customers does your company have?"],
|
| 330 |
-
customers_count=survey_responses["How many customers does your company have?"],
|
| 331 |
-
existing_tech=survey_responses["Which Industry 4.0 technologies do you already use in your supply chain?"],
|
| 332 |
-
use_tech_company=survey_responses["Do you use bundles of Industry 4.0 technologies? If so, which ones?"],
|
| 333 |
-
characteristics_improved=survey_responses["Which characteristics of your supply chain have been improved by I4.0 technologies?"],
|
| 334 |
-
characteristics_to_improve=survey_responses["What characteristics of your supply chain need to be improved in the future?"],
|
| 335 |
-
best_practices_knowledge=survey_responses["How well does your company know best practices for digitalisation in the supply chain?"],
|
| 336 |
-
up_to_date_info=survey_responses["How up-to-date is your company informed about new I4.0 technologies for the supply chain?"],
|
| 337 |
-
systematic_information_collection=survey_responses["How systematically does your company collect information about market trends and technologies for the supply chain?"],
|
| 338 |
-
easy_information_obtain=survey_responses["How easily can your company obtain information about innovative technologies for the supply chain?"],
|
| 339 |
-
closely_follow_competitors=survey_responses["How closely is your company following changes with competitors that use I4.0 technologies in the supply chain?"],
|
| 340 |
-
quickly_notice_changes=survey_responses["How quickly does your company notice changes in the dynamics of your supply chain?"],
|
| 341 |
-
quickly_recognize_potential=survey_responses["How quickly does your company recognise the potential of new technologies for supply chain processes?"],
|
| 342 |
-
recognize_new_approaches=survey_responses["How well do you recognize how new approaches can be implemented in our company?"],
|
| 343 |
-
translate_information=survey_responses["How well is your company able to translate information and impressions and apply it to your company?"],
|
| 344 |
-
successfully_use_information=survey_responses["How successfully does your company use current information in the context of digitization to develop and drive change?"],
|
| 345 |
-
well_prepared_processes=survey_responses["How well prepared are your supply chain processes to benefit from new technologies?"],
|
| 346 |
-
successfully_implement_changes=survey_responses["How successfully does your company implement planned changes in the supply chain?"],
|
| 347 |
-
successful_intro_in_past=survey_responses["How successful has your company been in introducing innovative technologies in the supply chain in the past?"],
|
| 348 |
-
clarity_responsibilities_roles=survey_responses["How clear are the responsibilities and roles in the introduction of I4.0 technologies in your supply chain?"],
|
| 349 |
-
change_projects_parallel=survey_responses["How well can change projects be carried out in your supply chain in parallel with day-to-day business?"],
|
| 350 |
-
flexibly_adapt_change_plans=survey_responses["How well is your company able to flexibly adapt change plans to the current situation?"],
|
| 351 |
-
available_resources=survey_responses["Which of the following resources are available to your organization for the digital transformation of the supply chain?"],
|
| 352 |
-
digital_skills=survey_responses["How do you rate the digital skills of employees in your supply chain?"],
|
| 353 |
-
technological_infrastructure_preparedness=survey_responses["How well is the technological infrastructure of your supply chain prepared for digital transformation?"],
|
| 354 |
-
flexible_financial_resources=survey_responses["How flexibly can financial resources be used for transformation projects in the supply chain?"],
|
| 355 |
-
supply_chain_partners_involvement=survey_responses["To what extent are your supply chain partners involved in transformation projects?"],
|
| 356 |
-
biggest_challenges=survey_responses["What challenges do you see as the biggest in the introduction of I4.0 technologies in your supply chain?"],
|
| 357 |
-
selection_criteria=survey_responses["What are the most important criteria for selecting and prioritizing technologies in your supply chain?"],
|
| 358 |
-
top_k=20
|
| 359 |
-
)
|
| 360 |
-
|
| 361 |
-
return recommendations
|
| 362 |
-
|
| 363 |
-
interface = gr.Interface(
|
| 364 |
-
fn=gradio_interface,
|
| 365 |
-
inputs=create_gradio_inputs(),
|
| 366 |
-
outputs=outputs,
|
| 367 |
-
title="Supply Chain 4.0 Recommender",
|
| 368 |
-
description="""
|
| 369 |
-
Welcome to the Supply Chain 4.0 Recommender.
|
| 370 |
-
This AI tool is designed to assist you in developing a strategy for your organisation's supply chain that allows for the implementation of Industry 4.0 technology bundles. The tool's knowledge base has been developed through a series of 31 survey questions.
|
| 371 |
-
To ensure an optimal outcome, please respond to the following questions as accurately as possible.
|
| 372 |
-
""",
|
| 373 |
-
theme="default",
|
| 374 |
-
)
|
| 375 |
-
|
| 376 |
-
if __name__ == "__main__":
|
| 377 |
-
interface.launch(share=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|