File size: 1,256 Bytes
6385041
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import streamlit as st
from transformers import pipeline 


###################################################
pipe = pipeline("text-generation", model='all-MiniLM-L6-v2')

    
def main():
    try:
        st.title("Which Resort is best for you?")

        weathers = ["Sunny", "Rainy", "Snowy"]
        activities = ["Skiing", "Hiking", "Swimming", "Relaxing"]
        weather = st.selectbox("What is the weather like?", weathers)
        activity = st.selectbox("What activity do you prefer?", activities)
        input_prompt = f"The weather is {weather.lower()} and I like {activity.lower()}."
        
        if st.button('Recommend a Resort'):
            with st.spinner('Generating recommendation...'):
                 # Generate text based on the input prompt
                generated_texts = pipe(input_prompt, max_length=50, num_return_sequences=1)
                recommendation = generated_texts[0]['generated_text']

                # Displaying the generated recommendation
                st.subheader("Recommended Resort:")
                st.write(recommendation)  
       
    except Exception as e:
        st.error(e)
         
###################################################
    if __name__=="main":
        main()