prithivMLmods commited on
Commit
8b3f75e
1 Parent(s): 37fb658

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -17
app.py CHANGED
@@ -107,23 +107,25 @@ def respond(
107
  response += token
108
  yield response
109
 
110
- # Arrange the inputs to separate the Mood dropdown into its own row
111
- system_message = gr.Textbox(value="", label="System message")
112
- max_tokens = gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens")
113
- temperature = gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature")
114
- top_p = gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-P")
115
- mood = gr.Dropdown(choices=list(mood_prompts.keys()), label="Mood", value="Casual")
116
-
117
- demo = gr.ChatInterface(
118
- respond,
119
- additional_inputs=[
120
- [system_message],
121
- [max_tokens, temperature, top_p],
122
- [mood], # Separate row for the Mood dropdown
123
- ],
124
- css=css,
125
- theme="allenai/gradio-theme",
126
- )
 
 
127
 
128
  if __name__ == "__main__":
129
  demo.launch()
 
107
  response += token
108
  yield response
109
 
110
+ # Layout with separate row for Mood
111
+ with gr.Blocks(css=css, theme="allenai/gradio-theme") as demo:
112
+ with gr.Row():
113
+ system_message = gr.Textbox(value="", label="System message")
114
+ max_tokens = gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens")
115
+ with gr.Row():
116
+ temperature = gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature")
117
+ top_p = gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-P")
118
+ with gr.Row():
119
+ mood = gr.Dropdown(
120
+ choices=list(mood_prompts.keys()),
121
+ label="Mood",
122
+ value="Casual"
123
+ )
124
+
125
+ gr.ChatInterface(
126
+ fn=respond,
127
+ inputs=[system_message, max_tokens, temperature, top_p, mood],
128
+ )
129
 
130
  if __name__ == "__main__":
131
  demo.launch()