MartinKosela commited on
Commit
25cc5a2
1 Parent(s): 252ec19

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +40 -2
app.py CHANGED
@@ -10,10 +10,48 @@ KNOWN_MODELS = [
10
  ]
11
 
12
  def recommend_ai_model_via_gpt(description):
13
- # ... [same as before]
 
 
 
 
 
 
 
 
 
 
14
 
15
  def explain_recommendation(model_name):
16
- # ... [same as before]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
 
18
  # Streamlit UI
19
  st.title('AI Model Recommender')
 
10
  ]
11
 
12
  def recommend_ai_model_via_gpt(description):
13
+ # Formulate a prompt for the large language model
14
+ prompt = f"Given the application described as: '{description}', which AI model would be most suitable?"
15
+
16
+ response = openai.Completion.create(
17
+ model="gpt-4.0-turbo",
18
+ prompt=prompt,
19
+ max_tokens=50
20
+ )
21
+
22
+ recommendation = response.choices[0].text.strip()
23
+ return recommendation
24
 
25
  def explain_recommendation(model_name):
26
+ # Formulate a prompt for explanation
27
+ prompt = f"Why would {model_name} be a suitable choice for the application?"
28
+
29
+ response = openai.Completion.create(
30
+ model="gpt-4.0-turbo",
31
+ prompt=prompt,
32
+ max_tokens=150
33
+ )
34
+
35
+ explanation = response.choices[0].text.strip()
36
+ return explanation
37
+
38
+ def get_feedback():
39
+ feedback = input("Was this recommendation helpful? (yes/no): ").lower()
40
+ if feedback == 'yes':
41
+ print("Thank you for your feedback!")
42
+ else:
43
+ print("Thank you! We'll strive to improve.")
44
+
45
+ def rate_explanation():
46
+ try:
47
+ rating = int(input("Rate the explanation from 1 (worst) to 5 (best): "))
48
+ if 1 <= rating <= 5:
49
+ print("Thank you for rating!")
50
+ else:
51
+ print("Invalid rating. Please rate between 1 and 5.")
52
+ except ValueError:
53
+ print("Invalid input. Please enter a number between 1 and 5.")
54
+
55
 
56
  # Streamlit UI
57
  st.title('AI Model Recommender')