Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,16 +8,33 @@ client = InferenceClient(
|
|
| 8 |
CSS = """
|
| 9 |
body {
|
| 10 |
background-color: black;
|
| 11 |
-
color: #FFFFFF; /* Default text color */
|
| 12 |
}
|
| 13 |
|
| 14 |
.gradio-container {
|
| 15 |
background-color: black;
|
| 16 |
-
color: #FFFFFF; /*
|
| 17 |
}
|
| 18 |
|
| 19 |
-
h1
|
| 20 |
color: #00FF00; /* Green header text */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
}
|
| 22 |
|
| 23 |
.gr-button {
|
|
@@ -30,57 +47,31 @@ CSS = """
|
|
| 30 |
background-color: #555555; /* Darker button on hover */
|
| 31 |
}
|
| 32 |
|
| 33 |
-
.gr-input {
|
| 34 |
-
background-color: #111111; /*
|
| 35 |
-
color: #00FF00; /*
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
.gr-output {
|
| 39 |
-
background-color: #111111; /* Output field dark background */
|
| 40 |
-
color: #00FFFF; /* Output text color */
|
| 41 |
}
|
| 42 |
|
| 43 |
.gr-slider {
|
| 44 |
-
background-color: #222222; /*
|
| 45 |
}
|
| 46 |
|
| 47 |
.gr-slider .range-slider {
|
| 48 |
-
background-color: #00FF00; /*
|
| 49 |
}
|
| 50 |
|
| 51 |
.gr-slider .range-slider__thumb {
|
| 52 |
-
background-color: #00FFFF; /*
|
| 53 |
}
|
| 54 |
|
| 55 |
.gr-examples {
|
| 56 |
-
color: #00FF00; /*
|
| 57 |
-
}
|
| 58 |
-
|
| 59 |
-
.gr-chatbox {
|
| 60 |
-
background-color: black; /* Chatbox dark background */
|
| 61 |
-
color: #FFFFFF; /* Chatbox text color */
|
| 62 |
-
}
|
| 63 |
-
|
| 64 |
-
.gr-chat-message {
|
| 65 |
-
background-color: #222222; /* Chat message dark background */
|
| 66 |
-
border-radius: 10px; /* Chat message rounded corners */
|
| 67 |
-
padding: 10px;
|
| 68 |
-
}
|
| 69 |
-
|
| 70 |
-
.gr-chat-message.user {
|
| 71 |
-
color: #00FF00; /* User message text color */
|
| 72 |
-
}
|
| 73 |
-
|
| 74 |
-
.gr-chat-message.bot {
|
| 75 |
-
color: #00FFFF; /* Bot message text color */
|
| 76 |
-
}
|
| 77 |
-
|
| 78 |
-
.gr-block {
|
| 79 |
-
background-color: black;
|
| 80 |
}
|
| 81 |
"""
|
| 82 |
|
| 83 |
|
|
|
|
| 84 |
def format_prompt(message, history):
|
| 85 |
prompt = "<s>"
|
| 86 |
for user_prompt, bot_response in history:
|
|
@@ -157,17 +148,18 @@ additional_inputs=[
|
|
| 157 |
]
|
| 158 |
|
| 159 |
# Create a Chatbot object with the desired height
|
| 160 |
-
|
| 161 |
-
|
| 162 |
|
| 163 |
with gr.Blocks(css=CSS) as demo:
|
| 164 |
-
gr.HTML("<h1>
|
| 165 |
gr.ChatInterface(
|
| 166 |
generate,
|
| 167 |
-
chatbot=chatbot,
|
| 168 |
additional_inputs=additional_inputs,
|
| 169 |
-
examples=[["Give me the code for Binary Search in C++"],
|
| 170 |
-
|
|
|
|
| 171 |
)
|
| 172 |
-
|
| 173 |
demo.queue().launch(debug=True)
|
|
|
|
|
|
| 8 |
CSS = """
|
| 9 |
body {
|
| 10 |
background-color: black;
|
| 11 |
+
color: #FFFFFF; /* Default text color for the entire app */
|
| 12 |
}
|
| 13 |
|
| 14 |
.gradio-container {
|
| 15 |
background-color: black;
|
| 16 |
+
color: #FFFFFF; /* Ensure the entire container is black with white text */
|
| 17 |
}
|
| 18 |
|
| 19 |
+
h1 {
|
| 20 |
color: #00FF00; /* Green header text */
|
| 21 |
+
text-align: center;
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
.gr-block, .gr-block > div, .gr-chatbox, .gr-box {
|
| 25 |
+
background-color: black !important; /* Ensure the background of all block elements is black */
|
| 26 |
+
color: #FFFFFF !important; /* White text for block elements */
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
.gr-chat-message {
|
| 30 |
+
background-color: #1A1A1A; /* Dark background for chat messages */
|
| 31 |
+
color: #00FFFF !important; /* Cyan text for bot responses */
|
| 32 |
+
border-radius: 10px;
|
| 33 |
+
padding: 10px;
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
.gr-chat-message.user {
|
| 37 |
+
color: #00FF00 !important; /* Green text for user messages */
|
| 38 |
}
|
| 39 |
|
| 40 |
.gr-button {
|
|
|
|
| 47 |
background-color: #555555; /* Darker button on hover */
|
| 48 |
}
|
| 49 |
|
| 50 |
+
input[type="text"], textarea, .gr-input, .gr-textbox {
|
| 51 |
+
background-color: #111111 !important; /* Ensure input fields are dark */
|
| 52 |
+
color: #00FF00 !important; /* Green input text */
|
| 53 |
+
border: 1px solid #FFFFFF;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
}
|
| 55 |
|
| 56 |
.gr-slider {
|
| 57 |
+
background-color: #222222; /* Dark slider background */
|
| 58 |
}
|
| 59 |
|
| 60 |
.gr-slider .range-slider {
|
| 61 |
+
background-color: #00FF00 !important; /* Green slider track */
|
| 62 |
}
|
| 63 |
|
| 64 |
.gr-slider .range-slider__thumb {
|
| 65 |
+
background-color: #00FFFF !important; /* Cyan slider thumb */
|
| 66 |
}
|
| 67 |
|
| 68 |
.gr-examples {
|
| 69 |
+
color: #00FF00; /* Green text for examples */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
}
|
| 71 |
"""
|
| 72 |
|
| 73 |
|
| 74 |
+
|
| 75 |
def format_prompt(message, history):
|
| 76 |
prompt = "<s>"
|
| 77 |
for user_prompt, bot_response in history:
|
|
|
|
| 148 |
]
|
| 149 |
|
| 150 |
# Create a Chatbot object with the desired height
|
| 151 |
+
|
| 152 |
+
chatbot = gr.Chatbot(height=450, label="Chatbot", container=True)
|
| 153 |
|
| 154 |
with gr.Blocks(css=CSS) as demo:
|
| 155 |
+
gr.HTML("<h1>🤖 Mistral-7B-Chat 💬</h1>")
|
| 156 |
gr.ChatInterface(
|
| 157 |
generate,
|
| 158 |
+
chatbot=chatbot,
|
| 159 |
additional_inputs=additional_inputs,
|
| 160 |
+
examples=[["Give me the code for Binary Search in C++"],
|
| 161 |
+
["Explain the chapter of The Grand Inquistor from The Brothers Karamazov."],
|
| 162 |
+
["Explain Newton's second law."]],
|
| 163 |
)
|
|
|
|
| 164 |
demo.queue().launch(debug=True)
|
| 165 |
+
|