Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,71 +6,90 @@ client = InferenceClient(
|
|
| 6 |
)
|
| 7 |
|
| 8 |
CSS = """
|
| 9 |
-
body {
|
| 10 |
-
background-color:
|
| 11 |
-
color: #FFFFFF;
|
| 12 |
}
|
| 13 |
|
| 14 |
.gradio-container {
|
| 15 |
-
|
| 16 |
-
|
| 17 |
}
|
| 18 |
|
| 19 |
h1 {
|
| 20 |
-
color: #00FF00;
|
| 21 |
text-align: center;
|
|
|
|
|
|
|
| 22 |
}
|
| 23 |
|
| 24 |
-
.gr-block, .gr-
|
| 25 |
-
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
}
|
| 28 |
|
| 29 |
.gr-chat-message {
|
| 30 |
-
background-color: #
|
| 31 |
-
|
| 32 |
-
border-radius:
|
| 33 |
padding: 10px;
|
|
|
|
| 34 |
}
|
| 35 |
|
| 36 |
.gr-chat-message.user {
|
| 37 |
-
color: #
|
| 38 |
}
|
| 39 |
|
| 40 |
.gr-button {
|
| 41 |
-
background-color: #
|
| 42 |
-
color: #FFFFFF;
|
| 43 |
-
border: 1px solid #
|
| 44 |
}
|
| 45 |
|
| 46 |
.gr-button:hover {
|
| 47 |
-
background-color: #
|
| 48 |
}
|
| 49 |
|
| 50 |
-
input[type="text"], textarea
|
| 51 |
-
background-color: #
|
| 52 |
-
color: #
|
| 53 |
-
border: 1px solid #
|
| 54 |
}
|
| 55 |
|
| 56 |
-
.gr-
|
| 57 |
-
background-color: #
|
|
|
|
|
|
|
| 58 |
}
|
| 59 |
|
| 60 |
-
.gr-
|
| 61 |
-
|
| 62 |
}
|
| 63 |
|
| 64 |
-
.gr-
|
| 65 |
-
background-color: #
|
| 66 |
}
|
| 67 |
|
| 68 |
-
.gr-
|
| 69 |
-
color: #
|
| 70 |
}
|
| 71 |
-
"""
|
| 72 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
|
| 75 |
def format_prompt(message, history):
|
| 76 |
prompt = "<s>"
|
|
@@ -107,7 +126,6 @@ def generate(
|
|
| 107 |
yield output
|
| 108 |
return output
|
| 109 |
|
| 110 |
-
|
| 111 |
additional_inputs=[
|
| 112 |
gr.Slider(
|
| 113 |
label="Temperature",
|
|
@@ -147,8 +165,6 @@ additional_inputs=[
|
|
| 147 |
)
|
| 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:
|
|
@@ -159,7 +175,6 @@ with gr.Blocks(css=CSS) as demo:
|
|
| 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 |
-
|
|
|
|
| 6 |
)
|
| 7 |
|
| 8 |
CSS = """
|
| 9 |
+
body, .gradio-container {
|
| 10 |
+
background-color: #0F1117;
|
| 11 |
+
color: #FFFFFF;
|
| 12 |
}
|
| 13 |
|
| 14 |
.gradio-container {
|
| 15 |
+
max-width: 100% !important;
|
| 16 |
+
padding: 0 !important;
|
| 17 |
}
|
| 18 |
|
| 19 |
h1 {
|
| 20 |
+
color: #00FF00;
|
| 21 |
text-align: center;
|
| 22 |
+
font-size: 2.5em;
|
| 23 |
+
margin-bottom: 20px;
|
| 24 |
}
|
| 25 |
|
| 26 |
+
.gr-block, .gr-box {
|
| 27 |
+
border-color: #2F3336 !important;
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
.gr-chatbot {
|
| 31 |
+
height: 450px;
|
| 32 |
+
overflow-y: auto;
|
| 33 |
+
border: 1px solid #2F3336;
|
| 34 |
+
border-radius: 8px;
|
| 35 |
+
background-color: #0F1117;
|
| 36 |
}
|
| 37 |
|
| 38 |
.gr-chat-message {
|
| 39 |
+
background-color: #1A1B26;
|
| 40 |
+
border: 1px solid #2F3336;
|
| 41 |
+
border-radius: 8px;
|
| 42 |
padding: 10px;
|
| 43 |
+
margin-bottom: 10px;
|
| 44 |
}
|
| 45 |
|
| 46 |
.gr-chat-message.user {
|
| 47 |
+
background-color: #2F3336;
|
| 48 |
}
|
| 49 |
|
| 50 |
.gr-button {
|
| 51 |
+
background-color: #2F3336 !important;
|
| 52 |
+
color: #FFFFFF !important;
|
| 53 |
+
border: 1px solid #4F5356 !important;
|
| 54 |
}
|
| 55 |
|
| 56 |
.gr-button:hover {
|
| 57 |
+
background-color: #3F4346 !important;
|
| 58 |
}
|
| 59 |
|
| 60 |
+
input[type="text"], textarea {
|
| 61 |
+
background-color: #1A1B26 !important;
|
| 62 |
+
color: #FFFFFF !important;
|
| 63 |
+
border: 1px solid #2F3336 !important;
|
| 64 |
}
|
| 65 |
|
| 66 |
+
.gr-form {
|
| 67 |
+
background-color: #0F1117 !important;
|
| 68 |
+
border: 1px solid #2F3336;
|
| 69 |
+
border-radius: 8px;
|
| 70 |
}
|
| 71 |
|
| 72 |
+
.gr-accordion {
|
| 73 |
+
border: 1px solid #2F3336 !important;
|
| 74 |
}
|
| 75 |
|
| 76 |
+
.gr-accordion-header {
|
| 77 |
+
background-color: #1A1B26 !important;
|
| 78 |
}
|
| 79 |
|
| 80 |
+
.gr-accordion-body {
|
| 81 |
+
background-color: #0F1117 !important;
|
| 82 |
}
|
|
|
|
| 83 |
|
| 84 |
+
.gr-examples {
|
| 85 |
+
border-top: 1px solid #2F3336 !important;
|
| 86 |
+
padding-top: 10px !important;
|
| 87 |
+
}
|
| 88 |
|
| 89 |
+
.gr-examples-text {
|
| 90 |
+
color: #AAAAAA !important;
|
| 91 |
+
}
|
| 92 |
+
"""
|
| 93 |
|
| 94 |
def format_prompt(message, history):
|
| 95 |
prompt = "<s>"
|
|
|
|
| 126 |
yield output
|
| 127 |
return output
|
| 128 |
|
|
|
|
| 129 |
additional_inputs=[
|
| 130 |
gr.Slider(
|
| 131 |
label="Temperature",
|
|
|
|
| 165 |
)
|
| 166 |
]
|
| 167 |
|
|
|
|
|
|
|
| 168 |
chatbot = gr.Chatbot(height=450, label="Chatbot", container=True)
|
| 169 |
|
| 170 |
with gr.Blocks(css=CSS) as demo:
|
|
|
|
| 175 |
additional_inputs=additional_inputs,
|
| 176 |
examples=[["Give me the code for Binary Search in C++"],
|
| 177 |
["Explain the chapter of The Grand Inquistor from The Brothers Karamazov."],
|
| 178 |
+
["Explain Newton's second law of motion."]],
|
| 179 |
)
|
| 180 |
+
demo.queue().launch(debug=True)
|
|
|