Spaces:
Runtime error
Runtime error
Update app.py
Browse files3 unmodified lines4567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586872 unmodified lines9091929394959697989910010110210310410520 unmodified lines1261271281291301311321331341351361371381391401411421431441451461471481491501511523 unmodified lines# SETS UP CLIENT INTERFACE APIclient = InferenceClient()# SVG vampire animation codeVAMPIRE_SVG = '''<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 400" style="width: 200px; height: 200px;"><defs><style>@keyframes eyeGlow {0%, 100% { filter: drop-shadow(0 0 2px #ff3300); }50% { filter: drop-shadow(0 0 4px #ff3300); }}@keyframes floating {0%, 100% { transform: translateY(0) rotate(-2deg); }50% { transform: translateY(-5px) rotate(2deg); }}@keyframes capeWave {0%, 100% { transform: skewX(0deg); }50% { transform: skewX(-5deg); }}@keyframes angryShake {0%, 100% { transform: translateX(0); }25% { transform: translateX(-2px); }75% { transform: translateX(2px); }}</style></defs><!-- Dramatic cape background --><g style="animation: capeWave 3s ease-in-out infinite"><path d="M100 150 Q 200 180 300 150 L 350 400 L 50 400 Z" fill="#880000"/><path d="M120 150 Q 200 170 280 150 L 320 400 L 80 400 Z" fill="#aa0000"/></g><!-- Main character group --><g style="animation: floating 4s ease-in-out infinite"><!-- Suit --><rect x="165" y="140" width="70" height="90" rx="5" fill="#111111"/><rect x="180" y="140" width="40" height="70" fill="#ffffff"/><path d="M185 150 Q 200 145 215 150 Q 200 155 185 150" fill="#cc0000"/><!-- Face --><path d="M160 130 C 160 70, 240 70, 240 130 Q 200 160 160 130" fill="#ffe6e6"/><!-- Angry pointed ears --><path d="M160 110 Q 150 95 165 105" fill="#ffe6e6"/><path d="M240 110 Q 250 95 235 105" fill="#ffe6e6"/><!-- Spiky angry hair --><g style="animation: angryShake 0.5s ease-in-out infinite"><path d="M155 120 C 150 60, 250 60, 245 120" fill="#111111"/><path d="M165 85 Q 175 60 185 85" fill="#111111"/><path d="M185 80 Q 200 50 215 80" fill="#111111"/><path d="M215 85 Q 225 60 235 85" fill="#111111"/></g><!-- Angry eyes --><g style="animation: eyeGlow 1s ease-in-out infinite"><path d="M165 105 Q 180 95 195 105 Q 180 115 165 105" fill="#ffffff"/><path d="M205 105 Q 220 95 235 105 Q 220 115 205 105" fill="#ffffff"/><circle cx="180" cy="105" r="8" fill="#ff3300"/><circle cx="220" cy="105" r="8" fill="#ff3300"/><circle cx="180" cy="105" r="4" fill="#000000"/><circle cx="220" cy="105" r="4" fill="#000000"/></g><!-- Angry eyebrows --><g style="animation: angryShake 0.5s ease-in-out infinite"><path d="M165 95 Q 180 85 195 95" stroke="#111111" stroke-width="3" fill="none"/><path d="M205 95 Q 220 85 235 95" stroke="#111111" stroke-width="3" fill="none"/></g><!-- Angry mouth with fangs --><path d="M185 125 Q 200 120 215 125" fill="none" stroke="#111111" stroke-width="2"/><path d="M190 125 L 195 133 L 200 125" fill="#ffffff"/><path d="M200 125 L 205 133 L 210 125" fill="#ffffff"/></g></svg>'''# Updated CSS with flexbox layoutCSS_CODE = '''body {background-color: black;2 unmodified linesbackground-position: center;background-position-y: -100px;}.vampire-container {display: flex;justify-content: center;margin-bottom: 20px;}.title {color: #cc0000;text-align: center;font-family: "Gothic", serif;text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);}'''20 unmodified linesyield history + [response]with gr.Blocks(css=CSS_CODE) as demo:gr.HTML(f'''<h1 class="title">DRACULABOT</h1><h2 class="title">A Dracula Themed AI ChatBot</h2><div class="vampire-container">{VAMPIRE_SVG}</div>''')with gr.Row():with gr.Column():chatbot = gr.Chatbot(height=600,label="Dracula",type="messages")prompt = gr.Textbox(max_lines=1,label="Chat Message",placeholder="Ask your question, Mortal")prompt.submit(respond, [prompt, chatbot], [chatbot])prompt.submit(lambda: "", None, [prompt])if __name__ == "__main__":demo.launch()3 unmodified lines4567891011121314152 unmodified lines181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757620 unmodified lines9798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311323 unmodified lines# SETS UP CLIENT INTERFACE APIclient = InferenceClient()# SVG vampire animation code (same as before)VAMPIRE_SVG = '''[Previous SVG code remains the same]'''# Updated CSS with right-aligned layoutCSS_CODE = '''body {background-color: black;2 unmodified linesbackground-position: center;background-position-y: -100px;}.container {display: flex;flex-direction: column;align-items: center;}.chat-container {display: flex;width: 100%;max-width: 1200px;gap: 20px;margin: 0 auto;}.chat-column {flex: 1;min-width: 0;}.vampire-column {width: 300px;position: sticky;top: 20px;align-self: flex-start;}.vampire-container {background: rgba(0, 0, 0, 0.5);border-radius: 10px;padding: 20px;margin-top: 20px;}.title {color: #cc0000;text-align: center;font-family: "Gothic", serif;text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);margin-bottom: 20px;}/* Custom styling for chat interface */.chatbot {background: rgba(0, 0, 0, 0.7) !important;border: 1px solid #cc0000 !important;border-radius: 10px !important;}.textbox {background: rgba(0, 0, 0, 0.7) !important;border: 1px solid #cc0000 !important;color: #ffffff !important;}'''20 unmodified linesyield history + [response]with gr.Blocks(css=CSS_CODE) as demo:with gr.Column(elem_classes="container"):gr.HTML('''<h1 class="title">DRACULABOT</h1><h2 class="title">A Dracula Themed AI ChatBot</h2>''')with gr.Row(elem_classes="chat-container"):with gr.Column(elem_classes="chat-column"):chatbot = gr.Chatbot(height=600,label="Dracula",type="messages",elem_classes="chatbot")prompt = gr.Textbox(max_lines=1,label="Chat Message",placeholder="Ask your question, Mortal",elem_classes="textbox")prompt.submit(respond, [prompt, chatbot], [chatbot])prompt.submit(lambda: "", None, [prompt])with gr.Column(elem_classes="vampire-column"):gr.HTML(f'''<div class="vampire-container">{VAMPIRE_SVG}</div>''')if __name__ == "__main__":demo.launch()
app.py+78-98