Spaces:
Runtime error
Runtime error
Commit
•
8f4f347
1
Parent(s):
9380cde
Updates to get it working again!
Browse files
app.py
CHANGED
@@ -3,15 +3,18 @@ import gradio as gr
|
|
3 |
|
4 |
client = InferenceClient("mistralai/Mistral-7B-Instruct-v0.1")
|
5 |
|
6 |
-
|
7 |
-
|
|
|
8 |
<div style="padding: 30px; text-align: center; display: flex; flex-direction: column; align-items: center;">
|
9 |
-
|
10 |
<h1 style="font-size: 28px; margin-bottom: 2px; opacity: 0.55;">Hi Jennifer, welcome to DTF</h1>
|
11 |
<p style="font-size: 18px; margin-bottom: 2px; opacity: 0.65;">Ask me anything about working at here...</p>
|
12 |
</div>.
|
13 |
"""
|
14 |
|
|
|
|
|
15 |
|
16 |
def format_prompt(message, history):
|
17 |
prompt = "<s>"
|
@@ -61,69 +64,62 @@ def generate(
|
|
61 |
return output
|
62 |
|
63 |
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
with gr.Blocks(fill_height=True) as demo:
|
104 |
-
|
105 |
-
gr.Image("/file=val_speaking_transparent.gif")
|
106 |
-
gr.Markdown("Hi I'm Val the Voyager, welcome onboard!")
|
107 |
-
gr.ChatInterface(
|
108 |
-
fn=generate,
|
109 |
-
chatbot=gr.Chatbot(
|
110 |
-
show_label=False,
|
111 |
-
show_share_button=False,
|
112 |
-
show_copy_button=True,
|
113 |
-
likeable=True,
|
114 |
-
layout="panel",
|
115 |
-
placeholder=PLACEHOLDER,
|
116 |
-
),
|
117 |
-
# additional_inputs=additional_inputs,
|
118 |
-
examples=[
|
119 |
-
["Ask me what an acronym stands for"],
|
120 |
-
["How can I check my leave allowance?"],
|
121 |
-
["Where can I find a floor map of 1 Macarthur?"],
|
122 |
-
["How can I find out about DTF's Disability network?"],
|
123 |
-
],
|
124 |
-
cache_examples=False,
|
125 |
-
title="""Voyager Val""",
|
126 |
-
)
|
127 |
|
128 |
-
|
129 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
|
4 |
client = InferenceClient("mistralai/Mistral-7B-Instruct-v0.1")
|
5 |
|
6 |
+
val_image = gr.Image("/file=val_speaking_transparent.gif")
|
7 |
+
|
8 |
+
PLACEHOLDER = f"""
|
9 |
<div style="padding: 30px; text-align: center; display: flex; flex-direction: column; align-items: center;">
|
10 |
+
<img src={val_image} style="width: 80%; max-width: 550px; height: auto; opacity: 0.55; ">
|
11 |
<h1 style="font-size: 28px; margin-bottom: 2px; opacity: 0.55;">Hi Jennifer, welcome to DTF</h1>
|
12 |
<p style="font-size: 18px; margin-bottom: 2px; opacity: 0.65;">Ask me anything about working at here...</p>
|
13 |
</div>.
|
14 |
"""
|
15 |
|
16 |
+
TITLE = "Hi I'm Val the Voyager, welcome onboard!"
|
17 |
+
|
18 |
|
19 |
def format_prompt(message, history):
|
20 |
prompt = "<s>"
|
|
|
64 |
return output
|
65 |
|
66 |
|
67 |
+
additional_inputs = [
|
68 |
+
gr.Slider(
|
69 |
+
label="Temperature",
|
70 |
+
value=0.9,
|
71 |
+
minimum=0.0,
|
72 |
+
maximum=1.0,
|
73 |
+
step=0.05,
|
74 |
+
interactive=True,
|
75 |
+
info="Higher values produce more diverse outputs",
|
76 |
+
),
|
77 |
+
gr.Slider(
|
78 |
+
label="Max new tokens",
|
79 |
+
value=256,
|
80 |
+
minimum=0,
|
81 |
+
maximum=1048,
|
82 |
+
step=64,
|
83 |
+
interactive=True,
|
84 |
+
info="The maximum numbers of new tokens",
|
85 |
+
),
|
86 |
+
gr.Slider(
|
87 |
+
label="Top-p (nucleus sampling)",
|
88 |
+
value=0.90,
|
89 |
+
minimum=0.0,
|
90 |
+
maximum=1,
|
91 |
+
step=0.05,
|
92 |
+
interactive=True,
|
93 |
+
info="Higher values sample more low-probability tokens",
|
94 |
+
),
|
95 |
+
gr.Slider(
|
96 |
+
label="Repetition penalty",
|
97 |
+
value=1.2,
|
98 |
+
minimum=1.0,
|
99 |
+
maximum=2.0,
|
100 |
+
step=0.05,
|
101 |
+
interactive=True,
|
102 |
+
info="Penalize repeated tokens",
|
103 |
+
),
|
104 |
+
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
|
106 |
+
gr.ChatInterface(
|
107 |
+
fn=generate,
|
108 |
+
chatbot=gr.Chatbot(
|
109 |
+
show_label=False,
|
110 |
+
show_share_button=False,
|
111 |
+
show_copy_button=True,
|
112 |
+
likeable=True,
|
113 |
+
layout="panel",
|
114 |
+
placeholder=PLACEHOLDER,
|
115 |
+
),
|
116 |
+
additional_inputs=additional_inputs,
|
117 |
+
examples=[
|
118 |
+
["Ask me what an acronym stands for"],
|
119 |
+
["How can I check my leave allowance?"],
|
120 |
+
["Where can I find a floor map of 1 Macarthur?"],
|
121 |
+
["How can I find out about DTF's Disability network?"],
|
122 |
+
],
|
123 |
+
cache_examples=False,
|
124 |
+
title=TITLE,
|
125 |
+
).launch(show_api=False)
|