Spaces:
Running
Running
star_nox
commited on
Commit
•
e5f680f
1
Parent(s):
a69153d
added UI components
Browse files
app.py
CHANGED
@@ -161,7 +161,7 @@ def radio_on_change(
|
|
161 |
)
|
162 |
|
163 |
|
164 |
-
title = """<h1 align="center">🔥
|
165 |
description = """Language models can be conditioned to act like dialogue agents through a conversational prompt that typically takes the form:
|
166 |
|
167 |
```
|
@@ -184,31 +184,62 @@ with gr.Blocks(
|
|
184 |
#chatbot {height: 520px; overflow: auto;}"""
|
185 |
) as demo:
|
186 |
gr.HTML(title)
|
187 |
-
with gr.
|
188 |
model = gr.Radio(
|
189 |
value="OpenAssistant/oasst-sft-1-pythia-12b",
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
)
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
212 |
with gr.Accordion("Parameters", open=False):
|
213 |
typical_p = gr.Slider(
|
214 |
minimum=-0,
|
@@ -256,6 +287,7 @@ with gr.Blocks(
|
|
256 |
)
|
257 |
watermark = gr.Checkbox(value=False, label="Text watermarking")
|
258 |
|
|
|
259 |
model.change(
|
260 |
lambda value: radio_on_change(
|
261 |
value,
|
@@ -295,7 +327,7 @@ with gr.Blocks(
|
|
295 |
],
|
296 |
[chatbot, state],
|
297 |
)
|
298 |
-
|
299 |
predict,
|
300 |
[
|
301 |
model,
|
@@ -311,7 +343,7 @@ with gr.Blocks(
|
|
311 |
],
|
312 |
[chatbot, state],
|
313 |
)
|
314 |
-
|
315 |
inputs.submit(reset_textbox, [], [inputs])
|
316 |
|
317 |
gr.Markdown(description)
|
|
|
161 |
)
|
162 |
|
163 |
|
164 |
+
title = """<h1 align="center">🔥Teaching Assistant Chatbot 🚀Streaming🚀</h1>"""
|
165 |
description = """Language models can be conditioned to act like dialogue agents through a conversational prompt that typically takes the form:
|
166 |
|
167 |
```
|
|
|
184 |
#chatbot {height: 520px; overflow: auto;}"""
|
185 |
) as demo:
|
186 |
gr.HTML(title)
|
187 |
+
with gr.Row():
|
188 |
model = gr.Radio(
|
189 |
value="OpenAssistant/oasst-sft-1-pythia-12b",
|
190 |
+
choices=[
|
191 |
+
"OpenAssistant/oasst-sft-1-pythia-12b",
|
192 |
+
# "togethercomputer/GPT-NeoXT-Chat-Base-20B",
|
193 |
+
"Rallio67/joi2_20Be_instruct_alpha",
|
194 |
+
"google/flan-t5-xxl",
|
195 |
+
"google/flan-ul2",
|
196 |
+
"bigscience/bloom",
|
197 |
+
"bigscience/bloomz",
|
198 |
+
"EleutherAI/gpt-neox-20b",
|
199 |
+
],
|
200 |
+
label="Model",
|
201 |
+
interactive=True,
|
202 |
+
)
|
203 |
+
with gr.Row():
|
204 |
+
with gr.Column():
|
205 |
+
use_gpt3_checkbox = gr.Checkbox(label="Include GPT-3 (paid)?")
|
206 |
+
with gr.Column():
|
207 |
+
use_equation_checkbox = gr.Checkbox(label="Prioritize equations?")
|
208 |
+
|
209 |
+
with gr.Row():
|
210 |
+
with gr.Column():
|
211 |
+
chatbot = gr.Chatbot(elem_id="chatbot")
|
212 |
+
inputs = gr.Textbox(
|
213 |
+
placeholder="Ask an Electrical Engineering question!", label="Type an input and press Enter"
|
214 |
+
)
|
215 |
+
examples = gr.Examples(
|
216 |
+
examples=[
|
217 |
+
["What is a Finite State Machine?"],
|
218 |
+
["How do you design a functional a Two-Bit Gray Code Counter?"],
|
219 |
+
],
|
220 |
+
inputs=[inputs],
|
221 |
+
outputs=[],
|
222 |
+
)
|
223 |
+
gr.Markdown("The top 3 retrieved contexts are:")
|
224 |
+
with gr.Row():
|
225 |
+
with gr.Column():
|
226 |
+
# add context retrieval here
|
227 |
+
context1 = gr.Textbox(label="Context 1")
|
228 |
+
with gr.Column():
|
229 |
+
context2 = gr.Textbox(label="Context 2")
|
230 |
+
with gr.Column():
|
231 |
+
context3 = gr.Textbox(label="Context 3")
|
232 |
+
|
233 |
+
gr.Markdown("Lecture Slides:")
|
234 |
+
with gr.Row():
|
235 |
+
# add CLIP part here
|
236 |
+
lec_gallery = gr.Gallery(label="Lecture images", show_label=False, elem_id="gallery").style(grid=[2], height="auto")
|
237 |
+
|
238 |
+
disclaimer = gr.Markdown(openchat_disclaimer, visible=False)
|
239 |
+
state = gr.State([])
|
240 |
+
run_btn = gr.Button(variant='primary',)
|
241 |
+
|
242 |
+
with gr.Row():
|
243 |
with gr.Accordion("Parameters", open=False):
|
244 |
typical_p = gr.Slider(
|
245 |
minimum=-0,
|
|
|
287 |
)
|
288 |
watermark = gr.Checkbox(value=False, label="Text watermarking")
|
289 |
|
290 |
+
|
291 |
model.change(
|
292 |
lambda value: radio_on_change(
|
293 |
value,
|
|
|
327 |
],
|
328 |
[chatbot, state],
|
329 |
)
|
330 |
+
run_btn.click(
|
331 |
predict,
|
332 |
[
|
333 |
model,
|
|
|
343 |
],
|
344 |
[chatbot, state],
|
345 |
)
|
346 |
+
run_btn.click(reset_textbox, [], [inputs])
|
347 |
inputs.submit(reset_textbox, [], [inputs])
|
348 |
|
349 |
gr.Markdown(description)
|