marcelbinz commited on
Commit
081efe7
·
verified ·
1 Parent(s): 85e8a39

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +39 -8
app.py CHANGED
@@ -31,15 +31,46 @@ pipe = pipeline(
31
  def infer(prompt):
32
  return pipe(prompt, max_new_tokens=1, do_sample=True, temperature=1.0, return_full_text=False)[0]["generated_text"]
33
 
34
- with gr.Blocks(fill_width=True, css="""
35
- #prompt-box textarea {height:200px}
36
- #answer-box textarea {height:320px}
37
- """) as demo:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  with gr.Row(equal_height=True):
39
- inp = gr.Textbox(label="Prompt", elem_id="prompt-box",
40
- lines=12, max_lines=12, scale=3)
41
- outp = gr.Textbox(label="Response", elem_id="answer-box",
42
- lines=1, interactive=False, scale=3)
 
 
 
 
43
 
44
  run = gr.Button("Run")
45
  run.click(infer, inp, outp)
 
31
  def infer(prompt):
32
  return pipe(prompt, max_new_tokens=1, do_sample=True, temperature=1.0, return_full_text=False)[0]["generated_text"]
33
 
34
+ default_experiment = 'text'
35
+
36
+ with gr.Blocks(
37
+ fill_width=True,
38
+ css="""
39
+ #prompt-box textarea {height:200px}
40
+ #answer-box textarea {height:320px}
41
+ #info-box {margin-bottom: 1rem} /* a little spacing */
42
+ """
43
+ ) as demo:
44
+
45
+ # ---------- NEW: info banner ----------
46
+ gr.Markdown(
47
+ """
48
+ ### About this Space
49
+ - **Model:** Llama-3.1 Minitaur-8B quantised to 4-bit
50
+ - **Speed-up:** Flash-Attention 2 & automatic device-mapping
51
+ - **Memory:** Fits on a single consumer GPU (~6 GB VRAM)
52
+ """,
53
+ elem_id="info-box",
54
+ )
55
+
56
+ # (optional) add a logo or hero image
57
+ gr.Image(
58
+ value="https://huggingface.co/datasets/huggingface/brand-assets/resolve/main/hf-logo.png",
59
+ show_label=False,
60
+ height=80,
61
+ elem_classes="mx-auto", # centres the image
62
+ )
63
+ # --------------------------------------
64
+
65
  with gr.Row(equal_height=True):
66
+ inp = gr.Textbox(
67
+ label="Prompt", elem_id="prompt-box",
68
+ lines=12, max_lines=12, scale=3, value="text"
69
+ )
70
+ outp = gr.Textbox(
71
+ label="Response", elem_id="answer-box",
72
+ lines=1, interactive=False, scale=3
73
+ )
74
 
75
  run = gr.Button("Run")
76
  run.click(infer, inp, outp)