Spaces:
Running
Running
moved advance options to the right
Browse files
app.py
CHANGED
@@ -107,39 +107,39 @@ def streamResponse(newMsg:str, chatHistory, instruction, temperature, max_tokens
|
|
107 |
else:
|
108 |
return "", chatHistory
|
109 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
# Build the app
|
111 |
with gr.Blocks(theme='Insuz/Mocha') as app:
|
112 |
with gr.Row():
|
113 |
-
with gr.Column(scale =
|
114 |
-
with gr.Accordion(label="Advanced options", open=True):
|
115 |
-
model = gr.Dropdown(
|
116 |
-
choices=["GPT-3.5", "GPT-4"],
|
117 |
-
value="GPT-3.5",
|
118 |
-
multiselect=False,
|
119 |
-
label="Model",
|
120 |
-
info="Choose the model you want to chat with.\nGo easy on GPT-4: it costs 500 times more than GPT 3.5!"
|
121 |
-
)
|
122 |
-
instruction = gr.Textbox(
|
123 |
-
value=SYSTEM_PROMPT,
|
124 |
-
label="System instructions",
|
125 |
-
lines=4,)
|
126 |
-
temperature = gr.Slider(
|
127 |
-
minimum=0,
|
128 |
-
maximum=2,
|
129 |
-
step=0.1,
|
130 |
-
value=0.7,
|
131 |
-
label="Temperature",
|
132 |
-
info="The higher, the more random the results will be"
|
133 |
-
)
|
134 |
-
max_token = gr.Slider(
|
135 |
-
minimum=64,
|
136 |
-
maximum=2048,
|
137 |
-
step=64,
|
138 |
-
value=1024,
|
139 |
-
label="Max Token",
|
140 |
-
info="Maximum number of token the model will take into consideration"
|
141 |
-
)
|
142 |
-
with gr.Column(scale = 8):
|
143 |
gr.Markdown("# Private GPT")
|
144 |
gr.Markdown("This chatbot is powered by the openAI GPT series.\
|
145 |
The default model is `GPT-3.5`, but `GPT-4` can be selected in the advanced options.\
|
@@ -161,7 +161,12 @@ with gr.Blocks(theme='Insuz/Mocha') as app:
|
|
161 |
inputs=[msg, chatbot, instruction, temperature, max_token, model],
|
162 |
outputs=[msg, chatbot]
|
163 |
)
|
164 |
-
|
|
|
|
|
|
|
|
|
|
|
165 |
gr.close_all()
|
166 |
app.queue().launch(auth=(AUTH_USERNAME, AUTH_PASSWORD))
|
167 |
# app.queue().launch()
|
|
|
107 |
else:
|
108 |
return "", chatHistory
|
109 |
|
110 |
+
# Define some components
|
111 |
+
model = gr.Dropdown(
|
112 |
+
choices=["GPT-3.5", "GPT-4"],
|
113 |
+
value="GPT-3.5",
|
114 |
+
multiselect=False,
|
115 |
+
label="Model",
|
116 |
+
info="Choose the model you want to chat with.\nGo easy on GPT-4: it costs 500 times more than GPT 3.5!"
|
117 |
+
)
|
118 |
+
instruction = gr.Textbox(
|
119 |
+
value=SYSTEM_PROMPT,
|
120 |
+
label="System instructions",
|
121 |
+
lines=4,)
|
122 |
+
temperature = gr.Slider(
|
123 |
+
minimum=0,
|
124 |
+
maximum=2,
|
125 |
+
step=0.1,
|
126 |
+
value=0.7,
|
127 |
+
label="Temperature",
|
128 |
+
info="The higher, the more random the results will be"
|
129 |
+
)
|
130 |
+
max_token = gr.Slider(
|
131 |
+
minimum=64,
|
132 |
+
maximum=2048,
|
133 |
+
step=64,
|
134 |
+
value=1024,
|
135 |
+
label="Max Token",
|
136 |
+
info="Maximum number of token the model will take into consideration"
|
137 |
+
)
|
138 |
+
|
139 |
# Build the app
|
140 |
with gr.Blocks(theme='Insuz/Mocha') as app:
|
141 |
with gr.Row():
|
142 |
+
with gr.Column(scale = 8, elem_classes=["float-left"]):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
gr.Markdown("# Private GPT")
|
144 |
gr.Markdown("This chatbot is powered by the openAI GPT series.\
|
145 |
The default model is `GPT-3.5`, but `GPT-4` can be selected in the advanced options.\
|
|
|
161 |
inputs=[msg, chatbot, instruction, temperature, max_token, model],
|
162 |
outputs=[msg, chatbot]
|
163 |
)
|
164 |
+
with gr.Column(scale = 1, elem_classes=["float-right"]):
|
165 |
+
with gr.Accordion(label="Advanced options", open=True):
|
166 |
+
model.render()
|
167 |
+
instruction.render()
|
168 |
+
temperature.render()
|
169 |
+
max_token.render()
|
170 |
gr.close_all()
|
171 |
app.queue().launch(auth=(AUTH_USERNAME, AUTH_PASSWORD))
|
172 |
# app.queue().launch()
|