Spaces:
Sleeping
Sleeping
prithivMLmods
commited on
Commit
•
cfbffd9
1
Parent(s):
b45b5dd
Update app.py
Browse files
app.py
CHANGED
@@ -78,6 +78,7 @@ def respond(
|
|
78 |
top_p,
|
79 |
mood
|
80 |
):
|
|
|
81 |
mood_prompt = mood_prompts.get(mood, "")
|
82 |
full_system_message = f"{system_message} {mood_prompt}".strip()
|
83 |
|
@@ -106,18 +107,26 @@ def respond(
|
|
106 |
response += token
|
107 |
yield response
|
108 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
demo = gr.ChatInterface(
|
110 |
respond,
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-P", visible=False),
|
117 |
-
gr.Dropdown(choices=list(mood_prompts.keys()), label="Mood Choices", value="Casual"),
|
118 |
],
|
|
|
119 |
css=css,
|
120 |
theme="allenai/gradio-theme",
|
|
|
121 |
)
|
122 |
|
123 |
if __name__ == "__main__":
|
|
|
78 |
top_p,
|
79 |
mood
|
80 |
):
|
81 |
+
# Update system message with mood prompt
|
82 |
mood_prompt = mood_prompts.get(mood, "")
|
83 |
full_system_message = f"{system_message} {mood_prompt}".strip()
|
84 |
|
|
|
107 |
response += token
|
108 |
yield response
|
109 |
|
110 |
+
# Define individual components
|
111 |
+
mood_choice = gr.Dropdown(choices=list(mood_prompts.keys()), label="Mood", value="Casual")
|
112 |
+
system_message = gr.Textbox(value="", label="System message", visible=False)
|
113 |
+
max_tokens = gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens", visible=False)
|
114 |
+
temperature = gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature", visible=False)
|
115 |
+
top_p = gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-P", visible=False)
|
116 |
+
|
117 |
+
# Integrate components into the interface
|
118 |
demo = gr.ChatInterface(
|
119 |
respond,
|
120 |
+
additional_inputs=[
|
121 |
+
system_message,
|
122 |
+
max_tokens,
|
123 |
+
temperature,
|
124 |
+
top_p,
|
|
|
|
|
125 |
],
|
126 |
+
interactive=True,
|
127 |
css=css,
|
128 |
theme="allenai/gradio-theme",
|
129 |
+
secondary_inputs=[mood_choice], # Adding mood_choice separately for visibility
|
130 |
)
|
131 |
|
132 |
if __name__ == "__main__":
|