Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -40,6 +40,37 @@ def respond(
|
|
| 40 |
response = tokenizer.decode(outputs[0][input_ids.shape[-1]:], skip_special_tokens=True)
|
| 41 |
yield response
|
| 42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
# The rest of your Gradio ChatInterface code remains the same
|
| 44 |
chatbot = gr.ChatInterface(
|
| 45 |
respond,
|
|
@@ -55,7 +86,10 @@ chatbot = gr.ChatInterface(
|
|
| 55 |
step=0.05,
|
| 56 |
label="Top-p (nucleus sampling)",
|
| 57 |
),
|
|
|
|
| 58 |
],
|
|
|
|
|
|
|
| 59 |
)
|
| 60 |
|
| 61 |
if __name__ == "__main__":
|
|
|
|
| 40 |
response = tokenizer.decode(outputs[0][input_ids.shape[-1]:], skip_special_tokens=True)
|
| 41 |
yield response
|
| 42 |
|
| 43 |
+
# -----------------------------------------------------------
|
| 44 |
+
# 1. Custom CSS for Logo Injection
|
| 45 |
+
# The Gradio app uses the 'a.gradio-image' selector for the header.
|
| 46 |
+
# We inject the logo as a background image on a custom element.
|
| 47 |
+
# -----------------------------------------------------------
|
| 48 |
+
custom_css = """
|
| 49 |
+
/* Hide the default Gradio title text */
|
| 50 |
+
#app > header > div.gradio-logo { visibility: hidden; }
|
| 51 |
+
|
| 52 |
+
/* Create a new element with a visible background image */
|
| 53 |
+
#custom_logo_container {
|
| 54 |
+
visibility: visible;
|
| 55 |
+
position: absolute;
|
| 56 |
+
top: 10px;
|
| 57 |
+
left: 10px;
|
| 58 |
+
width: 150px; /* Adjust size as needed */
|
| 59 |
+
height: 40px;
|
| 60 |
+
background-image: url('file=aeon-logo.png'); /* IMPORTANT: Use 'file=' prefix */
|
| 61 |
+
background-size: contain;
|
| 62 |
+
background-repeat: no-repeat;
|
| 63 |
+
background-position: left center;
|
| 64 |
+
z-index: 100;
|
| 65 |
+
}
|
| 66 |
+
"""
|
| 67 |
+
|
| 68 |
+
# -----------------------------------------------------------
|
| 69 |
+
# 2. Custom HTML for Logo Container
|
| 70 |
+
# We insert a <div> into the header to hold the logo.
|
| 71 |
+
# -----------------------------------------------------------
|
| 72 |
+
custom_html = '<div id="custom_logo_container"></div>'
|
| 73 |
+
|
| 74 |
# The rest of your Gradio ChatInterface code remains the same
|
| 75 |
chatbot = gr.ChatInterface(
|
| 76 |
respond,
|
|
|
|
| 86 |
step=0.05,
|
| 87 |
label="Top-p (nucleus sampling)",
|
| 88 |
),
|
| 89 |
+
|
| 90 |
],
|
| 91 |
+
css=custom_css,
|
| 92 |
+
title=custom_html, # Inject the HTML element into the title area
|
| 93 |
)
|
| 94 |
|
| 95 |
if __name__ == "__main__":
|