skolvankar commited on
Commit
ed7a51a
1 Parent(s): d4e1638

Add application file

Browse files
Files changed (1) hide show
  1. app.py +3 -23
app.py CHANGED
@@ -49,7 +49,7 @@ def html_coversion(gpt_content):
49
  processed_courses.append(processed_tuple)
50
 
51
  # Convert the processed list of tuples into a DataFrame
52
- df = pd.DataFrame(processed_courses, columns=['Sr No', 'Course Name', 'Course Link', 'Description'])
53
 
54
  # Convert the DataFrame to an HTML table
55
  html_table = df.to_html(index=False, escape=False)
@@ -76,29 +76,9 @@ def recommend_courses(user_skill, ed_qual):
76
  # Generate a text summary of the initial recommendations
77
  initial_recommendations_text = top_recommendations[['Course Name', 'Course Link']].to_string(index=False)
78
 
79
- # Combine user input and initial recommendations for GPT prompt
80
- gpt_prompt = f"Refine the following course recommendations based on user input:\n\n"\
81
- f"{user_input}\n\n"\
82
- f"Initial Recommendations:\n\n"\
83
- f"{initial_recommendations_text}"
84
-
85
- # Use GPT to generate refined recommendations
86
- gpt_response = client.chat.completions.create(
87
- messages=[
88
- {
89
- "role": "system",
90
- "content": gpt_prompt,
91
- }
92
- ],
93
- model="gpt-3.5-turbo",
94
- max_tokens=1000
95
- )
96
-
97
- # Assume GPT generates HTML-formatted final recommendations
98
- gpt_content = gpt_response.choices[0].message.content #gpt_response['choices'][0]['text']
99
-
100
  # Assume GPT generates HTML-formatted final recommendations
101
- final_recommendations_html = html_coversion(gpt_content)
102
 
103
  return final_recommendations_html
104
 
 
49
  processed_courses.append(processed_tuple)
50
 
51
  # Convert the processed list of tuples into a DataFrame
52
+ df = pd.DataFrame(processed_courses, columns=['Course Name', 'Course Link'])
53
 
54
  # Convert the DataFrame to an HTML table
55
  html_table = df.to_html(index=False, escape=False)
 
76
  # Generate a text summary of the initial recommendations
77
  initial_recommendations_text = top_recommendations[['Course Name', 'Course Link']].to_string(index=False)
78
 
79
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
  # Assume GPT generates HTML-formatted final recommendations
81
+ final_recommendations_html = html_coversion(initial_recommendations_text)
82
 
83
  return final_recommendations_html
84