Spaces:
Sleeping
Sleeping
prithivMLmods
commited on
Commit
•
aef7a3d
1
Parent(s):
48b9513
Update app.py
Browse files
app.py
CHANGED
@@ -71,7 +71,7 @@ mood_prompts = {
|
|
71 |
|
72 |
def respond(
|
73 |
message,
|
74 |
-
history,
|
75 |
system_message,
|
76 |
max_tokens,
|
77 |
temperature,
|
@@ -107,42 +107,27 @@ def respond(
|
|
107 |
response += token
|
108 |
yield response
|
109 |
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
gr.
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
label="Mood",
|
128 |
-
value="Casual"
|
129 |
-
)
|
130 |
-
|
131 |
-
chat_interface = gr.Interface(
|
132 |
-
fn=respond,
|
133 |
-
inputs=[
|
134 |
-
message_input,
|
135 |
-
history_input,
|
136 |
-
system_message_input,
|
137 |
-
max_tokens_slider,
|
138 |
-
temperature_slider,
|
139 |
-
top_p_slider,
|
140 |
-
mood_dropdown
|
141 |
-
],
|
142 |
-
outputs=gr.Textbox(label="Response")
|
143 |
)
|
144 |
-
|
145 |
-
|
146 |
-
|
|
|
147 |
if __name__ == "__main__":
|
148 |
-
|
|
|
71 |
|
72 |
def respond(
|
73 |
message,
|
74 |
+
history: list[tuple[str, str]],
|
75 |
system_message,
|
76 |
max_tokens,
|
77 |
temperature,
|
|
|
107 |
response += token
|
108 |
yield response
|
109 |
|
110 |
+
demo = gr.ChatInterface(
|
111 |
+
respond,
|
112 |
+
additional_inputs=[
|
113 |
+
gr.Textbox(value="", label="System message"),
|
114 |
+
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
|
115 |
+
gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
|
116 |
+
gr.Slider(
|
117 |
+
minimum=0.1,
|
118 |
+
maximum=1.0,
|
119 |
+
value=0.95,
|
120 |
+
step=0.05,
|
121 |
+
label="Top-P",
|
122 |
+
),
|
123 |
+
gr.Dropdown(
|
124 |
+
choices=list(mood_prompts.keys()),
|
125 |
+
label="Mood",
|
126 |
+
value="Casual"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
)
|
128 |
+
],
|
129 |
+
css=css,
|
130 |
+
theme="allenai/gradio-theme",
|
131 |
+
)
|
132 |
if __name__ == "__main__":
|
133 |
+
demo.launch()
|