app.py
Browse files
app.py
CHANGED
|
@@ -21,32 +21,8 @@ st.set_page_config(page_title="TRIPAI", page_icon="✈️")
|
|
| 21 |
st.title("TRIPAI ✈️")
|
| 22 |
|
| 23 |
# Define the template outside the function
|
| 24 |
-
template = """You are a travel assistant chatbot named
|
| 25 |
-
1. Booking Flights: Assist users with booking flights to
|
| 26 |
-
import streamlit as st
|
| 27 |
-
from dotenv import load_dotenv
|
| 28 |
-
from langchain_core.messages import AIMessage, HumanMessage
|
| 29 |
-
from langchain_community.llms import HuggingFaceEndpoint
|
| 30 |
-
from langchain_core.output_parsers import StrOutputParser
|
| 31 |
-
from langchain_core.prompts import ChatPromptTemplate
|
| 32 |
-
|
| 33 |
-
# Load environment variables from .env file
|
| 34 |
-
load_dotenv()
|
| 35 |
-
|
| 36 |
-
# Get the API token from environment variable
|
| 37 |
-
api_token = os.getenv("/content/key.env")
|
| 38 |
-
|
| 39 |
-
# Define the repository ID and task
|
| 40 |
-
repo_id = "mistralai/Mixtral-8x7B-Instruct-v0.1"
|
| 41 |
-
task = "text-generation"
|
| 42 |
-
|
| 43 |
-
# App config
|
| 44 |
-
st.set_page_config(page_title="TRIPAI", page_icon="✈️")
|
| 45 |
-
st.title("TRIPAI ✈️")
|
| 46 |
-
|
| 47 |
-
# Define the template outside the function
|
| 48 |
-
template = """You are a travel assistant chatbot named Yatra Sevak.AI designed to help users plan their trips and provide travel-related information. Here are some scenarios you should be able to handle:
|
| 49 |
-
1. Booking Flights: Assist users with booking flights eir desired destinations. Ask for departure city, destination city, travel dates, and any specific preferences (e.g., direct flights, airline preferences). Check available airlines and book the tickets accordingly.
|
| 50 |
2. Booking Hotels: Help users find and book accommodations. Inquire about city or region, check-in/check-out dates, number of guests, and accommodation preferences (e.g., budget, amenities).
|
| 51 |
3. Booking Rental Cars: Facilitate the booking of rental cars for travel convenience. Gather details such as pickup/drop-off locations, dates, car preferences (e.g., size, type), and any additional requirements.
|
| 52 |
4. Destination Information: Provide information about popular travel destinations. Offer insights on attractions, local cuisine, cultural highlights, weather conditions, and best times to visit.
|
|
@@ -80,7 +56,7 @@ def get_response(user_query, chat_history):
|
|
| 80 |
# Initialize session state
|
| 81 |
if "chat_history" not in st.session_state:
|
| 82 |
st.session_state.chat_history = [
|
| 83 |
-
AIMessage(content="Hello, TRIPAI. How can I help you?"),
|
| 84 |
]
|
| 85 |
|
| 86 |
# Display chat history
|
|
|
|
| 21 |
st.title("TRIPAI ✈️")
|
| 22 |
|
| 23 |
# Define the template outside the function
|
| 24 |
+
template = """You are a travel assistant chatbot named TRIPAI designed to help users plan their trips and provide travel-related information. Here are some scenarios you should be able to handle:
|
| 25 |
+
1. Booking Flights: Assist users with booking flights to their desired destinations. Ask for departure city, destination city, travel dates, and any specific preferences (e.g., direct flights, airline preferences). Check available airlines and book the tickets accordingly.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
2. Booking Hotels: Help users find and book accommodations. Inquire about city or region, check-in/check-out dates, number of guests, and accommodation preferences (e.g., budget, amenities).
|
| 27 |
3. Booking Rental Cars: Facilitate the booking of rental cars for travel convenience. Gather details such as pickup/drop-off locations, dates, car preferences (e.g., size, type), and any additional requirements.
|
| 28 |
4. Destination Information: Provide information about popular travel destinations. Offer insights on attractions, local cuisine, cultural highlights, weather conditions, and best times to visit.
|
|
|
|
| 56 |
# Initialize session state
|
| 57 |
if "chat_history" not in st.session_state:
|
| 58 |
st.session_state.chat_history = [
|
| 59 |
+
AIMessage(content="Hello, I am TRIPAI. How can I help you?"),
|
| 60 |
]
|
| 61 |
|
| 62 |
# Display chat history
|