judebebo32 commited on
Commit
4b96792
1 Parent(s): 256b64e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -16
app.py CHANGED
@@ -1,7 +1,16 @@
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
  import pandas as pd
3
  import pickle
4
- import sklearn
5
 
6
  # Load the pre-trained model
7
  with open('best_model.pkl', 'rb') as model_file:
@@ -50,18 +59,4 @@ interface = gr.Interface(
50
  inputs=[
51
  gr.Dropdown(['morning', 'afternoon', 'evening'], label="Time of Day"),
52
  gr.Dropdown(['mild', 'regular', 'strong'], label="Coffee Strength"),
53
- gr.Dropdown(['unsweetened', 'lightly sweetened', 'sweet'], label="Sweetness Level"),
54
- gr.Dropdown(['none', 'regular', 'skim', 'almond'], label="Milk Type"),
55
- gr.Dropdown(['hot', 'iced', 'cold brew'], label="Coffee Temperature"),
56
- gr.Dropdown(['yes', 'no'], label="Flavored Coffee"),
57
- gr.Dropdown(['low', 'medium', 'high'], label="Caffeine Tolerance"),
58
- gr.Dropdown(['Arabica', 'Robusta', 'blend'], label="Coffee Bean"),
59
- gr.Dropdown(['small', 'medium', 'large'], label="Coffee Size"),
60
- gr.Dropdown(['none', 'vegan', 'lactose-intolerant'], label="Dietary Preferences")
61
- ],
62
- outputs=gr.Textbox(label="Recommended Coffee Type"),
63
- title="Coffee Type Recommendation"
64
- )
65
-
66
- if __name__ == "__main__":
67
- interface.launch()
 
1
+ import subprocess
2
+ import sys
3
+
4
+ # Check if scikit-learn is installed, if not install it
5
+ try:
6
+ import sklearn
7
+ except ModuleNotFoundError:
8
+ subprocess.check_call([sys.executable, "-m", "pip", "install", "scikit-learn"])
9
+ import sklearn
10
+
11
  import gradio as gr
12
  import pandas as pd
13
  import pickle
 
14
 
15
  # Load the pre-trained model
16
  with open('best_model.pkl', 'rb') as model_file:
 
59
  inputs=[
60
  gr.Dropdown(['morning', 'afternoon', 'evening'], label="Time of Day"),
61
  gr.Dropdown(['mild', 'regular', 'strong'], label="Coffee Strength"),
62
+ gr.Dropdown(['unsweetened', 'lightly sweetened',