Spaces:
Sleeping
Sleeping
DariaKhot
commited on
Commit
•
b44c3dc
1
Parent(s):
2ab515e
Add application file
Browse files
app.py
CHANGED
@@ -3,34 +3,26 @@ from transformers import pipeline
|
|
3 |
|
4 |
|
5 |
###################################################
|
6 |
-
|
|
|
7 |
|
8 |
|
9 |
-
|
10 |
-
try:
|
11 |
-
st.title("Which Resort is best for you?")
|
12 |
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
|
29 |
-
except Exception as e:
|
30 |
-
st.error(e)
|
31 |
-
|
32 |
-
###################################################
|
33 |
-
if __name__=="main":
|
34 |
-
main()
|
35 |
-
|
36 |
|
|
|
3 |
|
4 |
|
5 |
###################################################
|
6 |
+
model_name = "sentence-transformers/all-MiniLM-L6-v2"
|
7 |
+
pipe = pipeline("text-generation", model=model_name)
|
8 |
|
9 |
|
10 |
+
st.title("Which Resort is best for you?")
|
|
|
|
|
11 |
|
12 |
+
weathers = ["Sunny", "Rainy", "Snowy"]
|
13 |
+
activities = ["Skiing", "Hiking", "Swimming", "Relaxing"]
|
14 |
+
weather = st.selectbox("What is the weather like?", weathers)
|
15 |
+
activity = st.selectbox("What activity do you prefer?", activities)
|
16 |
+
input_prompt = f"The weather is {weather.lower()} and I like {activity.lower()}."
|
17 |
|
18 |
+
if st.button('Recommend a Resort'):
|
19 |
+
with st.spinner('Generating recommendation...'):
|
20 |
+
# Generate text based on the input prompt
|
21 |
+
generated_texts = pipe(input_prompt, max_length=50, num_return_sequences=1)
|
22 |
+
recommendation = generated_texts[0]['generated_text']
|
23 |
|
24 |
+
# Displaying the generated recommendation
|
25 |
+
st.subheader("Recommended Resort:")
|
26 |
+
st.write(recommendation)
|
27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
|