DariaKhot
Add application file
b44c3dc
raw
history blame
1.01 kB
import streamlit as st
from transformers import pipeline
###################################################
model_name = "sentence-transformers/all-MiniLM-L6-v2"
pipe = pipeline("text-generation", model=model_name)
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)