Spaces:
Running
on
Zero
Running
on
Zero
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() |