MekkCyber commited on
Commit
d400133
·
1 Parent(s): a2b76ed
Files changed (1) hide show
  1. app.py +23 -11
app.py CHANGED
@@ -89,20 +89,31 @@ def run_transformers(model_name, input_text, num_tokens):
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,10 +127,10 @@ def interface():
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,12 +148,12 @@ def interface():
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",
145
- choices=["TinyLlama/TinyLlama_v1.1", "HuggingFaceTB/SmolLM-360M"],
146
  value="TinyLlama/TinyLlama_v1.1",
147
  interactive=True
148
  )
@@ -160,6 +171,7 @@ def interface():
160
  return demo
161
 
162
  demo = interface()
 
163
  # # Access FastAPI app instance from Gradio
164
  # fastapi_app = demo.app
165
 
 
89
 
90
  # Gradio Interface
91
  def interface():
92
+ with gr.Blocks(theme=gr.themes.Ocean()) as demo:
93
 
94
  # Header
95
  gr.Markdown(
96
  """
97
+ <h1 style="text-align: center; color: #7AB8E5;">BitNet.cpp Speed Demonstration 💻</h1>
98
+ <p style="text-align: center; color: #6A1B9A;">Compare the speed and performance of BitNet with popular Transformer models.</p>
99
  """,
100
  elem_id="header"
101
  )
102
 
103
+ # Instructions
104
+ gr.Markdown(
105
+ """
106
+ ### Instructions for Using the BitNet.cpp Speed Demonstration
107
+ 1. **Set Up Your Project**: Begin by selecting the model you wish to use. Please note that this process may take a few minutes to complete.
108
+ 2. **Select Token Count**: Choose the number of tokens you want to generate for your inference.
109
+ 3. **Input Your Text**: Enter the text you wish to analyze, then compare the performance of BitNet with popular Transformer models.
110
+ """,
111
+ elem_id="instructions"
112
+ )
113
+
114
  # Model Selection and Setup
115
+ with gr.Column(elem_id="container"):
116
+ gr.Markdown("<h2 style='color: #5CA2D3; text-align: center;'>Model Selection and Setup</h2>")
117
  with gr.Row():
118
  model_dropdown = gr.Dropdown(
119
  label="Select Model",
 
127
  )
128
  setup_button = gr.Button("Run Setup")
129
  setup_status = gr.Textbox(label="Setup Status", interactive=False, placeholder="Setup status will appear here...")
130
+
131
  # Inference Section
132
+ with gr.Column(elem_id="container"):
133
+ gr.Markdown("<h2 style='color: #5CA2D3; text-align: center;'>BitNet Inference</h2>")
134
  with gr.Row():
135
  num_tokens = gr.Slider(
136
  minimum=1, maximum=100,
 
148
  time_output = gr.Textbox(label="Inference Time", interactive=False, placeholder="Inference time will appear here...")
149
 
150
  # Comparison with Transformers Section
151
+ with gr.Column(elem_id="container"):
152
+ gr.Markdown("<h2 style='color: #5CA2D3; text-align: center;'>Compare with Transformers</h2>")
153
  with gr.Row():
154
  transformer_model_dropdown = gr.Dropdown(
155
  label="Select Transformers Model",
156
+ choices=["TinyLlama/TinyLlama_v1.1"],
157
  value="TinyLlama/TinyLlama_v1.1",
158
  interactive=True
159
  )
 
171
  return demo
172
 
173
  demo = interface()
174
+
175
  # # Access FastAPI app instance from Gradio
176
  # fastapi_app = demo.app
177