File size: 8,583 Bytes
76df764
 
26e8c98
0516d26
ca89e64
 
0516d26
 
41958d2
0516d26
41958d2
 
 
0516d26
41958d2
0516d26
 
41958d2
 
 
0516d26
 
 
 
 
 
 
41958d2
 
 
 
0516d26
 
 
 
 
41958d2
0516d26
41958d2
0516d26
 
41958d2
0516d26
 
 
 
 
 
 
 
 
 
41958d2
 
0516d26
 
ca89e64
0516d26
 
ca89e64
0516d26
 
 
41958d2
0516d26
 
41958d2
0516d26
ca89e64
 
0516d26
 
ca89e64
 
0516d26
 
4a38fbc
ca89e64
0516d26
 
ca89e64
0516d26
 
 
 
 
 
41958d2
0516d26
41958d2
 
0516d26
 
 
ca89e64
0516d26
 
ca89e64
0516d26
 
 
 
 
 
41958d2
 
 
0516d26
ca89e64
 
0516d26
 
41958d2
 
 
 
0516d26
 
 
41958d2
 
 
 
 
 
 
 
0516d26
 
41958d2
0516d26
41958d2
0516d26
 
41958d2
0516d26
41958d2
 
 
0516d26
 
41958d2
0516d26
 
41958d2
0516d26
 
 
 
 
 
41958d2
0516d26
 
 
41958d2
0516d26
41958d2
0516d26
41958d2
0516d26
 
 
41958d2
0516d26
 
41958d2
 
 
 
 
 
 
 
 
 
 
0516d26
 
41958d2
0516d26
 
41958d2
 
 
0516d26
41958d2
0516d26
 
41958d2
 
0516d26
41958d2
0516d26
41958d2
0516d26
ca89e64
 
 
0516d26
4a38fbc
 
ca89e64
0516d26
41958d2
0516d26
41958d2
 
0516d26
41958d2
 
 
0516d26
 
 
 
 
 
 
 
 
 
 
41958d2
 
 
ca89e64
41958d2
0516d26
 
41958d2
 
0516d26
 
ca89e64
0516d26
41958d2
 
 
 
0516d26
41958d2
 
 
 
0516d26
41958d2
0516d26
41958d2
 
 
 
 
0516d26
 
41958d2
 
 
 
 
 
 
 
 
0516d26
41958d2
 
 
 
0516d26
41958d2
 
 
0516d26
41958d2
 
 
 
0516d26
41958d2
 
 
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
import gradio as gr
from chatbot import respond

# Ultra-unique travel-themed CSS
custom_css = """
.gradio-container {
    font-family: 'Cinzel', serif; /* Vintage explorer font */
    background: url('https://www.transparenttextures.com/patterns/old-map.png') repeat, linear-gradient(135deg, #2b2d42 0%, #8d5524 50%, #d4a017 100%); /* Map texture + earthy tones */
    color: #ffffff;
    padding: 50px;
    min-height: 100vh;
    position: relative;
    overflow: hidden;
    animation: windBlow 25s infinite ease-in-out;
}

/* Compass and travel artifacts */
.gradio-container::before {
    content: '';
    position: absolute;
    top: 10%;
    left: 5%;
    width: 120px;
    height: 120px;
    background: url('https://img.icons8.com/?size=100&id=10447&format=png&color=000000') no-repeat center;
    opacity: 0.4;
    animation: compassSpin 20s infinite linear;
}
.gradio-container::after {
    content: '';
    position: absolute;
    bottom: 5%;
    right: 5%;
    width: 100px;
    height: 100px;
    background: url('https://img.icons8.com/?size=100&id=98766&format=png&color=000000') no-repeat center; /* Suitcase */
    opacity: 0.3;
    animation: suitcaseBounce 10s infinite ease-in-out;
}

/* Chat container with parchment vibe */
.chatbot {
    background: rgba(245, 245, 220, 0.9); /* Parchment-like */
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), inset 0 0 10px rgba(139, 69, 19, 0.3);
    border: 3px solid #8d5524; /* Leather-brown border */
    transition: all 0.5s ease;
    width: 90%;
    max-width: 900px;
    height: 1000px; /* Matches your increased height */
    overflow-y: auto;
}
.chatbot:hover {
    border-color: #d4a017; /* Golden highlight */
    box-shadow: 0 15px 50px rgba(212, 160, 23, 0.4);
}

/* Messages with travel flair */
.chatbot .message {
    border-radius: 15px;
    padding: 20px 25px;
    margin: 15px 0;
    max-width: 75%;
    font-size: 18px;
    animation: messageFade 0.6s ease-out;
    border: none !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}
.chatbot .message.bot {
    background: linear-gradient(135deg, #87cefa 0%, #4682b4 100%); /* Ocean breeze */
    color: #ffffff;
}
.chatbot .message.user {
    background: linear-gradient(135deg, #deb887 0%, #cd853f 100%); /* Sandy desert */
    color: #2b2d42;
    margin-left: auto;
}

/* Textbox with explorer’s journal style */
.textbox {
    background: rgba(245, 245, 220, 0.7);
    border: 3px solid #8d5524;
    border-radius: 20px;
    color: #2b2d42;
    padding: 15px 30px;
    font-size: 18px;
    transition: all 0.4s ease;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.2);
}
.textbox:focus {
    border-color: #d4a017;
    background: rgba(245, 245, 220, 0.9);
    box-shadow: 0 0 25px rgba(212, 160, 23, 0.7);
}

/* Button with adventure flair */
.button {
    background: linear-gradient(135deg, #d4a017 0%, #8d5524 100%); /* Gold to leather */
    color: #ffffff;
    border-radius: 20px;
    padding: 15px 40px;
    font-size: 18px;
    font-weight: 700;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(139, 69, 19, 0.4);
}
.button:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(212, 160, 23, 0.6);
}
.button::after {
    content: '';
    position: absolute;
    width: 120px;
    height: 120px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    transform: scale(0);
    animation: ripple 0.6s linear;
    pointer-events: none;
}
.button:active::after {
    animation: ripple 0.6s linear;
}

/* Title and subheader with explorer’s charm */
h1 {
    font-size: 3.5em;
    text-align: center;
    color: #d4a017; /* Golden */
    text-shadow: 4px 4px 12px rgba(0, 0, 0, 0.5);
    margin-bottom: 10px;
    animation: titleReveal 2s ease-in-out;
}
h3 {
    text-align: center;
    color: #ffffff;
    font-size: 1.6em;
    margin-bottom: 30px;
    animation: fadeIn 2.5s ease-in-out;
    font-style: italic;
}

/* Animations */
@keyframes windBlow {
    0% { background-position: 0 0; }
    50% { background-position: 100px 100px; }
    100% { background-position: 0 0; }
}
@keyframes compassSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
@keyframes suitcaseBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-25px); }
}
@keyframes messageFade {
    0% { opacity: 0; transform: translateX(-20px); }
    100% { opacity: 1; transform: translateX(0); }
}
@keyframes titleReveal {
    0% { opacity: 0; transform: scale(0.9); }
    60% { opacity: 1; transform: scale(1.05); }
    100% { opacity: 1; transform: scale(1); }
}
@keyframes fadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}
@keyframes ripple {
    0% { transform: scale(0); opacity: 1; }
    100% { transform: scale(4); opacity: 0; }
}

/* Slider with travel aesthetic */
.slider {
    --track-color: #8d5524;
    --thumb-color: #d4a017;
    transition: all 0.3s ease;
}
.slider:hover {
    --thumb-color: #ffffff;
}

/* Footer */
.footer {
    text-align: center;
    color: #ffffff !important;
    font-size: 1em;
    margin-top: 2em;
    animation: fadeIn 3s ease-in-out;
    text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.3);
}
"""

# Enhanced travel-themed respond function
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🧭 **Explorer’s Hint:** Chart a course with 'Flights from London to Tokyo in May' or 'Hidden gems in Barcelona from March 10 2025 to March 15 2025'! ✈️"
    else:
        response = f"🗺️ {response} 🌍 Where will your compass point next, adventurer? ✈️"
    return history + [[message, response]], ""  # Clears textbox

# Ultimate travel interface
with gr.Blocks(css=custom_css) as demo:
    gr.Markdown(
        """
        <div style="color: white !important;">
            🗺️ Forged by Travelo LLC | Unravel the globe’s wonders, one tale at a time! ✈️
        </div>
        """,
        elem_classes=["footer"]
    )

    gr.Markdown(
        """
        # ✈️ Travelo - The Explorer’s Chronicle 🧭
        ### Embark on Epic Quests with Your Trusty Guide!
        """,
        elem_classes=["title"]
    )

    chatbot = gr.Chatbot(
        height=1000,  # Kept your increased height
        label="Travelo’s Logbook",
        bubble_full_width=False,
        avatar_images=(
            "https://img.icons8.com/?size=100&id=98766&format=png&color=000000",  # Suitcase
            "https://img.icons8.com/?size=100&id=124350&format=png&color=000000"  # Airplane
        ),
        placeholder="🗺️ Begin your epic tale here, weary traveler..."
    )

    with gr.Row(variant="compact"):
        textbox = gr.Textbox(
            placeholder="Seek your destiny! (e.g., 'Secret trails in Patagonia')",
            lines=1,
            elem_classes=["textbox"],
            autofocus=True
        )
        submit_btn = gr.Button("✈️ Set Sail", elem_classes=["button"])

    with gr.Accordion("🧭 Explorer’s Gear", open=False):
        max_tokens = gr.Slider(
            minimum=1,
            maximum=2048,
            value=512,
            step=1,
            label="Legend Length",
            info="How vast shall your travel saga be?"
        )

    system_message = 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.",
        visible=False
    )

    gr.Markdown(
        """
        🗺️ Forged by Travelo LLC | Unravel the globe’s wonders, one tale at a time! ✈️
        """,
        elem_classes=["footer"]
    )

    # Event triggers
    textbox.submit(
        enhanced_respond,
        inputs=[textbox, chatbot, system_message, max_tokens],
        outputs=[chatbot, textbox]
    )
    submit_btn.click(
        enhanced_respond,
        inputs=[textbox, chatbot, system_message, max_tokens],
        outputs=[chatbot, textbox]
    )

demo.launch()