Spaces:
Running
Running
MekkCyber
commited on
Commit
·
a2b76ed
1
Parent(s):
294b6b7
update
Browse files
app.py
CHANGED
@@ -89,73 +89,20 @@ def run_transformers(model_name, input_text, num_tokens):
|
|
89 |
|
90 |
# Gradio Interface
|
91 |
def interface():
|
92 |
-
with gr.Blocks(
|
93 |
-
body {
|
94 |
-
background-color: #F7F9FC; /* Light gray for a clean look */
|
95 |
-
color: #333333; /* Dark gray for text for easy readability */
|
96 |
-
font-family: 'Arial', sans-serif;
|
97 |
-
}
|
98 |
-
|
99 |
-
/* Button styling */
|
100 |
-
.gr-button {
|
101 |
-
background-color: #2196F3; /* Bright blue */
|
102 |
-
color: white;
|
103 |
-
border-radius: 6px;
|
104 |
-
padding: 10px 15px;
|
105 |
-
border: 1px solid #1976D2; /* Slightly darker blue for border */
|
106 |
-
font-weight: bold;
|
107 |
-
}
|
108 |
-
.gr-button:hover {
|
109 |
-
background-color: #1976D2; /* Darker blue on hover */
|
110 |
-
}
|
111 |
-
|
112 |
-
/* Header styling */
|
113 |
-
#header {
|
114 |
-
color: #333333; /* Dark gray for better contrast on light background */
|
115 |
-
background-color: #E3F2FD; /* Very light blue background */
|
116 |
-
padding: 20px;
|
117 |
-
border-radius: 8px;
|
118 |
-
text-align: center;
|
119 |
-
}
|
120 |
-
|
121 |
-
/* Container styling for sections */
|
122 |
-
.container {
|
123 |
-
background-color: #FFFFFF; /* White for a clean container look */
|
124 |
-
border-radius: 8px;
|
125 |
-
padding: 20px;
|
126 |
-
margin: 20px 0;
|
127 |
-
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* Soft shadow for depth */
|
128 |
-
}
|
129 |
-
.container h2 {
|
130 |
-
color: #2196F3; /* Bright blue for subheaders */
|
131 |
-
text-align: center;
|
132 |
-
}
|
133 |
-
|
134 |
-
/* Center alignment for UI components */
|
135 |
-
.center {
|
136 |
-
text-align: center;
|
137 |
-
}
|
138 |
-
|
139 |
-
/* Center button alignment */
|
140 |
-
.center-button {
|
141 |
-
display: flex;
|
142 |
-
justify-content: center;
|
143 |
-
margin: 10px;
|
144 |
-
}
|
145 |
-
""") as demo:
|
146 |
|
147 |
# Header
|
148 |
gr.Markdown(
|
149 |
"""
|
150 |
-
<h1 style="text-align: center; color: #
|
151 |
-
<p style="text-align: center; color: #
|
152 |
""",
|
153 |
elem_id="header"
|
154 |
)
|
155 |
|
156 |
# Model Selection and Setup
|
157 |
-
with gr.Column(
|
158 |
-
gr.Markdown("<h2 style='color: #
|
159 |
with gr.Row():
|
160 |
model_dropdown = gr.Dropdown(
|
161 |
label="Select Model",
|
@@ -169,10 +116,10 @@ def interface():
|
|
169 |
)
|
170 |
setup_button = gr.Button("Run Setup")
|
171 |
setup_status = gr.Textbox(label="Setup Status", interactive=False, placeholder="Setup status will appear here...")
|
172 |
-
|
173 |
# Inference Section
|
174 |
-
with gr.Column(
|
175 |
-
gr.Markdown("<h2 style='color: #
|
176 |
with gr.Row():
|
177 |
num_tokens = gr.Slider(
|
178 |
minimum=1, maximum=100,
|
@@ -190,8 +137,8 @@ def interface():
|
|
190 |
time_output = gr.Textbox(label="Inference Time", interactive=False, placeholder="Inference time will appear here...")
|
191 |
|
192 |
# Comparison with Transformers Section
|
193 |
-
with gr.Column(
|
194 |
-
gr.Markdown("<h2 style='color: #
|
195 |
with gr.Row():
|
196 |
transformer_model_dropdown = gr.Dropdown(
|
197 |
label="Select Transformers Model",
|
|
|
89 |
|
90 |
# Gradio Interface
|
91 |
def interface():
|
92 |
+
with gr.Blocks(theme=gr.themes.Ocean()) as demo: # Apply the Ocean theme
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
|
94 |
# Header
|
95 |
gr.Markdown(
|
96 |
"""
|
97 |
+
<h1 style="text-align: center; color: #003f5c;">BitNet.cpp Speed Demonstration 💻</h1>
|
98 |
+
<p style="text-align: center; color: #0074a4;">Compare the speed and performance of BitNet with popular Transformer models.</p>
|
99 |
""",
|
100 |
elem_id="header"
|
101 |
)
|
102 |
|
103 |
# Model Selection and Setup
|
104 |
+
with gr.Column():
|
105 |
+
gr.Markdown("<h2 style='color: #005073; text-align: center;'>Model Selection and Setup</h2>")
|
106 |
with gr.Row():
|
107 |
model_dropdown = gr.Dropdown(
|
108 |
label="Select Model",
|
|
|
116 |
)
|
117 |
setup_button = gr.Button("Run Setup")
|
118 |
setup_status = gr.Textbox(label="Setup Status", interactive=False, placeholder="Setup status will appear here...")
|
119 |
+
|
120 |
# Inference Section
|
121 |
+
with gr.Column():
|
122 |
+
gr.Markdown("<h2 style='color: #005073; text-align: center;'>BitNet Inference</h2>")
|
123 |
with gr.Row():
|
124 |
num_tokens = gr.Slider(
|
125 |
minimum=1, maximum=100,
|
|
|
137 |
time_output = gr.Textbox(label="Inference Time", interactive=False, placeholder="Inference time will appear here...")
|
138 |
|
139 |
# Comparison with Transformers Section
|
140 |
+
with gr.Column():
|
141 |
+
gr.Markdown("<h2 style='color: #005073; text-align: center;'>Compare with Transformers</h2>")
|
142 |
with gr.Row():
|
143 |
transformer_model_dropdown = gr.Dropdown(
|
144 |
label="Select Transformers Model",
|