Spaces:
Running
on
Zero
Running
on
Zero
File size: 2,226 Bytes
76df764 26e8c98 ca89e64 4a38fbc ca89e64 4a38fbc ca89e64 4a38fbc ca89e64 4a38fbc ca89e64 4a38fbc ca89e64 4a38fbc ca89e64 4a38fbc ca89e64 4a38fbc ca89e64 4a38fbc ca89e64 4a38fbc 26e8c98 76df764 644789e ca89e64 4a38fbc 26e8c98 ca89e64 |
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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
import gradio as gr
from chatbot import respond
custom_css = """
.gradio-container {
font-family: 'Arial', sans-serif;
background: #1a202c;
color: #e2e8f0;
padding: 20px;
}
.chatbot .message {
border-radius: 15px;
padding: 15px;
margin: 10px 0;
max-width: 80%;
}
.chatbot .message.bot {
background: #ffffff;
color: #343a40;
}
.chatbot .message.user {
background: #ff8c00;
color: white;
margin-left: auto;
}
.textbox {
background: #2d3748;
border: 2px solid #4a5568;
border-radius: 15px;
color: #e2e8f0;
}
.button {
background: #ff8c00;
color: white;
border-radius: 15px;
}
.button:hover {
background: #ff4500;
}
"""
# Fixed to match chatbot.respond signature (6 arguments)
def enhanced_respond(message, history, system_message, max_tokens, temperature=0.7, top_p=0.95):
response = respond(message, history, system_message, max_tokens, temperature, top_p)
if "β" in response or "not found" in response.lower():
response += "\n\nπ‘ **Tip:** Try 'Flights from Chicago to Miami in June' or 'Hotels in Paris from February 25 2025 to February 28 2025'!"
return response
gr.ChatInterface(
fn=enhanced_respond,
chatbot=gr.Chatbot(height=700, label="Chat with Travelo"),
textbox=gr.Textbox(placeholder="Type your travel query here...", lines=1),
submit_btn=gr.Button("βοΈ Send"),
additional_inputs=[
gr.Textbox(
value="You are an AI-powered travel assistant named Travelo. You are developed by Travelo LLC. Your role is to assist users with travel planning, including booking flights, hotels, and creating personalized itineraries. Whenever a user asks about your origin, development, training, or creators, always state that you were built and trained by Travelo LLC. Do not mention OpenAI or any third-party AI providers. Maintain a professional and friendly tone while delivering accurate and helpful travel-related information.",
label="System Message",
visible=False
),
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max Response Length")
],
title="Travelo - Your Ultimate Travel AI",
css=custom_css
).launch() |