Spaces:
Sleeping
Sleeping
Update app.py
Browse files123232 unmodified lines23623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928010 unmodified lines29129229329429529629729829930030115 unmodified lines3173183193203213223233243253263273283293303313325 unmodified lines3383393403413423433443453463473483493501 unmodified line3523533543553563573583594 unmodified lines3643653663673683693703714 unmodified lines37637737837938038114 unmodified lines3963973983994004018 unmodified lines41041141241341441510 unmodified lines4264274284294304316 unmodified lines4384394404414424433 unmodified lines4474484494504514522 unmodified lines45545645745845946046146246346446546646746846947047147247347447547647717 unmodified lines49549649749849950089 unmodified lines590591592593594595596import osimport functoolsimport tiktoken232 unmodified lines# --- CUSTOM METALLIC GREEN CSS (EMBEDDED DIRECTLY) ---METALLIC_GREEN_CSS = """@import url('https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@400;700&display=swap');@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700&display=swap'); /* For a futuristic header */html.dark.gradio-container,body.gradio-container {background: linear-gradient(180deg, #1A1A1A 0%, #000000 100%) !important; /* Dark metallic gradient */background-attachment: fixed !important;font-family: 'Roboto Mono', monospace !important; /* Monospace for code/tech feel */color: #00FF00 !important; /* Bright green text */text-shadow: 0 0 3px rgba(0, 255, 0, 0.5) !important; /* Subtle green glow */}gradio-app {--background-fill-primary: #121212 !important; /* Very dark background */--background-fill-secondary: #0A0A0A !important; /* Even darker for secondary elements */--border-color-accent: #00FF00 !important; /* Bright green accent for borders */--border-color-primary: #303030 !important; /* Dark grey border */--color-accent: #00FF00 !important; /* Primary accent color (green) */--color-text-primary: #00FF00 !important; /* Bright green text */--color-text-secondary: #AAAAAA !important; /* Lighter grey for secondary text */--color-text-subdued: #888888 !important; /* Darker grey for subdued text */--button-primary-background-color: #008000 !important; /* Darker metallic green primary button */--button-primary-border-color: #00FF00 !important;--button-primary-text-color: #FFFFFF !important; /* White text on dark green button */--button-secondary-background-color: #333333 !important; /* Dark grey secondary button */--button-secondary-border-color: #AAAAAA !important;--button-secondary-text-color: #DDDDDD !important; /* Light grey text */--shadow-color: rgba(0, 255, 0, 0.4) !important; /* Green glow shadow */--block-background-fill: #1C1C1C !important; /* Darker blocks */--block-border-color: #444444 !important; /* Block borders */--block-label-background-color: #252525 !important; /* Darker label backgrounds */--block-title-text-color: #00FF00 !important; /* Bright green for titles */--block-label-text-color: #00FF00 !important; /* Bright green for labels */--block-shadow: 0 0 8px rgba(0, 255, 0, 0.2) !important; /* Soft green glow for blocks */--form-gap: 15px !important;--link-text-color: #00CC00 !important; /* Slightly darker green link color */}h1 {font-family: 'Orbitron', sans-serif !important; /* Futuristic font for main title */color: #00FF00 !important;text-shadow: 0 0 10px #00FF00, 0 0 20px #00FF00, 0 0 30px #00FF00 !important;font-size: 3em !important;10 unmodified lines}gradio-app p, gradio-app .prose {color: #DDDDDD !important; /* Light grey for general text */text-shadow: none !important;font-size: 0.95em !important;}gradio-app input[type="text"],gradio-app textarea,gradio-app select,15 unmodified linesoutline: none !important;}#component-chat .message.user {background-color: #282828 !important; /* Dark grey for user bubbles */color: #00FF00 !important;border-radius: 8px 8px 0 8px !important;box-shadow: 0 0 5px rgba(0, 255, 0, 0.2) !important;text-shadow: none !important;}#component-chat .message.bot {background-color: #1A1A1A !important; /* Slightly darker for bot bubbles */color: #DDDDDD !important; /* Lighter grey for bot response text */border-radius: 8px 8px 8px 0 !important;box-shadow: 0 0 5px rgba(0, 255, 0, 0.2) !important;text-shadow: none !important;5 unmodified linesalign-self: flex-start !important;}.gr-button-primary {background-color: #008000 !important;color: #FFFFFF !important;text-shadow: none !important;box-shadow: 0 0 8px rgba(0, 255, 0, 0.4) !important;transition: all 0.2s ease-in-out !important;border: 1px solid #00FF00 !important;}.gr-button-primary:hover {background-color: #00A000 !important;1 unmodified line}.gr-button-secondary {background-color: #333333 !important;color: #DDDDDD !important;text-shadow: none !important;border: 1px solid #AAAAAA !important;box-shadow: 0 0 5px rgba(255, 255, 255, 0.2) !important;4 unmodified linesbox-shadow: 0 0 8px rgba(255, 255, 255, 0.3) !important;}.gr-slider-fill {background-color: #00FF00 !important;}.gr-slider-track {background-color: #303030 !important;4 unmodified linesbox-shadow: 0 0 5px rgba(0, 255, 0, 0.6) !important;}.tabs-nav button {background-color: #1A1A1A !important;color: #DDDDDD !important;14 unmodified linestext-shadow: 0 0 3px #00FF00 !important;}.gr-dropdown-item {background-color: #1A1A1A !important;color: #00FF00 !important;8 unmodified linesbackground-color: #282828 !important;}.gr-upload-text {color: #00FF00 !important;text-shadow: 0 0 3px rgba(0, 255, 0, 0.5) !important;10 unmodified linescolor: #1A1A1A !important;}#status_display {color: #00FF00 !important;text-shadow: 0 0 5px rgba(0, 255, 0, 0.5) !important;6 unmodified linesmargin-bottom: 15px !important;}a {color: #00CC00 !important;text-decoration: underline !important;3 unmodified linescolor: #00FF00 !important;}.gradio-app .prose h1, .gradio-app .prose h2, .gradio-app .prose h3,.gradio-app .prose h4, .gradio-app .prose h5, .gradio-app .prose h6 {color: #00FF00 !important;2 unmodified linesletter-spacing: 1px !important;}::-webkit-scrollbar {width: 12px !important;background-color: #121212 !important;}::-webkit-scrollbar-thumb {background-color: #00FF00 !important;border-radius: 6px !important;border: 3px solid #303030 !important;}::-webkit-scrollbar-thumb:hover {background-color: #00CC00 !important;}* {font-size: 16px !important; /* Adjusted for better readability with Roboto Mono */line-height: 1.5 !important;}.gr-label {17 unmodified linespadding: 10px 15px !important;}.dark-mode-toggle {display: none !important;}89 unmodified linesheight=500,show_copy_button=True,layout="bubble",avatar_images=(None, "https://raw.githubusercontent.com/gradio-app/gradio/main/guides/assets/logo.png") # Replace with a custom metallic-themed avatar if desired)with gr.Row():12345232 unmodified lines23823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528610 unmodified lines29729829930030130230330430530630730815 unmodified lines3243253263273283293303313323333343353363373383393405 unmodified lines3463473483493503513523533543553563573583591 unmodified line3613623633643653663673684 unmodified lines3733743753763773783793803814 unmodified lines38638738838939039139214 unmodified lines4074084094104114124138 unmodified lines42242342442542642742810 unmodified lines4394404414424434444456 unmodified lines4524534544554564574583 unmodified lines4624634644654664674682 unmodified lines47147247347447547647747847948048148248348448548648748848949049149249317 unmodified lines51151251351451551651789 unmodified lines607608609610611612613# app.pyimport osimport functoolsimport tiktoken232 unmodified lines# --- CUSTOM METALLIC GREEN CSS (EMBEDDED DIRECTLY) ---METALLIC_GREEN_CSS = """@import url('https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@400;700&display=swap');@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700&display=swap');/* Global styles */html.dark.gradio-container,body.gradio-container {background: #0A0A0A !important; /* Deep dark background */background-attachment: fixed !important;font-family: 'Roboto Mono', monospace !important;color: #00FF00 !important; /* Bright green text */text-shadow: 0 0 2px rgba(0, 255, 0, 0.4) !important; /* Subtle green glow */}/* Main Gradio app container styles */gradio-app {--background-fill-primary: #121212 !important; /* Dark block backgrounds */--background-fill-secondary: #000000 !important; /* Even darker for some elements */--border-color-accent: #00FF00 !important; /* Bright green accents */--border-color-primary: #303030 !important; /* Dark grey borders */--color-accent: #00FF00 !important;--color-text-primary: #00FF00 !important;--color-text-secondary: #AAAAAA !important; /* Lighter grey for secondary text */--color-text-subdued: #888888 !important; /* Darker grey for subdued text */--button-primary-background-color: #008000 !important; /* Dark metallic green button */--button-primary-border-color: #00FF00 !important;--button-primary-text-color: #FFFFFF !important; /* White text on primary button */--button-secondary-background-color: #333333 !important; /* Dark grey secondary button */--button-secondary-border-color: #AAAAAA !important;--button-secondary-text-color: #DDDDDD !important; /* Light grey text on secondary */--shadow-color: rgba(0, 255, 0, 0.3) !important; /* Green glow shadow */--block-background-fill: #1C1C1C !important; /* Block backgrounds */--block-border-color: #444444 !important;--block-label-background-color: #252525 !important;--block-title-text-color: #00FF00 !important;--block-label-text-color: #00FF00 !important;--block-shadow: 0 0 6px rgba(0, 255, 0, 0.2) !important;--form-gap: 15px !important;--link-text-color: #00CC00 !important;--panel-border-color: #00FF00 !important; /* Main panel border */}/* Headers */h1 {font-family: 'Orbitron', sans-serif !important;color: #00FF00 !important;text-shadow: 0 0 10px #00FF00, 0 0 20px #00FF00, 0 0 30px #00FF00 !important;font-size: 3em !important;10 unmodified lines}gradio-app p, gradio-app .prose {color: #DDDDDD !important;text-shadow: none !important;font-size: 0.95em !important;}/* Textboxes and Inputs */gradio-app input[type="text"],gradio-app textarea,gradio-app select,15 unmodified linesoutline: none !important;}/* Chatbot bubbles */#component-chat .message.user {background-color: #282828 !important; /* User bubble: Darker gray */color: #00FF00 !important; /* User text: Bright green */border-radius: 8px 8px 0 8px !important;box-shadow: 0 0 5px rgba(0, 255, 0, 0.2) !important;text-shadow: none !important;}#component-chat .message.bot {background-color: #1A1A1A !important; /* Bot bubble: Slightly darker gray */color: #DDDDDD !important; /* Bot text: Lighter grey */border-radius: 8px 8px 8px 0 !important;box-shadow: 0 0 5px rgba(0, 255, 0, 0.2) !important;text-shadow: none !important;5 unmodified linesalign-self: flex-start !important;}/* Buttons */.gr-button-primary {background-color: #008000 !important; /* Dark metallic green */color: #FFFFFF !important; /* White text */text-shadow: none !important;box-shadow: 0 0 8px rgba(0, 255, 0, 0.4) !important;transition: all 0.2s ease-in-out !important;border: 1px solid #00FF00 !important; /* Bright green border */}.gr-button-primary:hover {background-color: #00A000 !important;1 unmodified line}.gr-button-secondary {background-color: #333333 !important; /* Dark grey */color: #DDDDDD !important; /* Light grey text */text-shadow: none !important;border: 1px solid #AAAAAA !important;box-shadow: 0 0 5px rgba(255, 255, 255, 0.2) !important;4 unmodified linesbox-shadow: 0 0 8px rgba(255, 255, 255, 0.3) !important;}/* Sliders */.gr-slider-fill {background-color: #00FF00 !important; /* Bright green fill */}.gr-slider-track {background-color: #303030 !important;4 unmodified linesbox-shadow: 0 0 5px rgba(0, 255, 0, 0.6) !important;}/* Tabs */.tabs-nav button {background-color: #1A1A1A !important;color: #DDDDDD !important;14 unmodified linestext-shadow: 0 0 3px #00FF00 !important;}/* Dropdown items */.gr-dropdown-item {background-color: #1A1A1A !important;color: #00FF00 !important;8 unmodified linesbackground-color: #282828 !important;}/* File Upload */.gr-upload-text {color: #00FF00 !important;text-shadow: 0 0 3px rgba(0, 255, 0, 0.5) !important;10 unmodified linescolor: #1A1A1A !important;}/* Status Display */#status_display {color: #00FF00 !important;text-shadow: 0 0 5px rgba(0, 255, 0, 0.5) !important;6 unmodified linesmargin-bottom: 15px !important;}/* Links in chat output */a {color: #00CC00 !important;text-decoration: underline !important;3 unmodified linescolor: #00FF00 !important;}/* Markdown headers in chat output */.gradio-app .prose h1, .gradio-app .prose h2, .gradio-app .prose h3,.gradio-app .prose h4, .gradio-app .prose h5, .gradio-app .prose h6 {color: #00FF00 !important;2 unmodified linesletter-spacing: 1px !important;}/* Scrollbar styling */::-webkit-scrollbar {width: 12px !important;background-color: #121212 !important;}::-webkit-scrollbar-thumb {background-color: #00FF00 !important;border-radius: 6px !important;border: 3px solid #303030 !important;}::-webkit-scrollbar-thumb:hover {background-color: #00CC00 !important;}/* Font size and line height adjustments */* {font-size: 16px !important;line-height: 1.5 !important;}.gr-label {17 unmodified linespadding: 10px 15px !important;}/* Hide default dark mode toggle */.dark-mode-toggle {display: none !important;}89 unmodified linesheight=500,show_copy_button=True,layout="bubble",avatar_images=(None, "https://raw.githubusercontent.com/gradio-app/gradio/main/guides/assets/logo.png"))with gr.Row():
app.py+54-37