Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -29,18 +29,17 @@ def generate(description, model, max_tokens):
|
|
29 |
error_message = data['error']['message']
|
30 |
print(f'Ошибка: {error_message}')
|
31 |
else:
|
32 |
-
print(f'Не удалось сгенерировать текст.
|
33 |
|
34 |
|
35 |
# css
|
36 |
css = """
|
37 |
footer {visibility: hidden !important;}
|
38 |
-
.gradio-tabs-header {display: none !important;}
|
39 |
"""
|
40 |
|
41 |
|
42 |
# ui
|
43 |
-
with gr.Blocks(css=css
|
44 |
with gr.Tabs() as tabs:
|
45 |
with gr.Row():
|
46 |
with gr.Tab("Запрос", id='request v'):
|
@@ -51,13 +50,13 @@ with gr.Blocks(css=css, title="UI") as vui:
|
|
51 |
with gr.Row():
|
52 |
with gr.Column(scale=3):
|
53 |
with gr.Row():
|
54 |
-
model = gr.Radio(show_label=True, label="Модель", interactive=True, choices=["gpt-3.5-turbo", "gpt-3.5-turbo-16k", "gpt-4"], value="gpt-3.5-turbo")
|
55 |
with gr.Row():
|
56 |
-
max_tokens = gr.Slider(show_label=True, label="
|
57 |
with gr.Column():
|
58 |
text_button = gr.Button("Генерация", variant='primary', elem_id="generate")
|
59 |
with gr.Column(scale=2):
|
60 |
-
text_output = gr.Textbox(show_label=False)
|
61 |
|
62 |
text_button.click(generate, inputs=[promt, model, max_tokens], outputs=text_output)
|
63 |
|
|
|
29 |
error_message = data['error']['message']
|
30 |
print(f'Ошибка: {error_message}')
|
31 |
else:
|
32 |
+
print(f'Не удалось сгенерировать текст. Повторите попытку позже...')
|
33 |
|
34 |
|
35 |
# css
|
36 |
css = """
|
37 |
footer {visibility: hidden !important;}
|
|
|
38 |
"""
|
39 |
|
40 |
|
41 |
# ui
|
42 |
+
with gr.Blocks(css=css) as vui:
|
43 |
with gr.Tabs() as tabs:
|
44 |
with gr.Row():
|
45 |
with gr.Tab("Запрос", id='request v'):
|
|
|
50 |
with gr.Row():
|
51 |
with gr.Column(scale=3):
|
52 |
with gr.Row():
|
53 |
+
model = gr.Radio(show_label=True, label="Модель", interactive=True, choices=["gpt-3.5-turbo", "gpt-3.5-turbo-16k", "gpt-3.5-turbo-16k-0613", "gpt-4"], value="gpt-3.5-turbo")
|
54 |
with gr.Row():
|
55 |
+
max_tokens = gr.Slider(show_label=True, label="Максимальное количество токенов", minimum=100, maximum=15000, value=5000, step=1)
|
56 |
with gr.Column():
|
57 |
text_button = gr.Button("Генерация", variant='primary', elem_id="generate")
|
58 |
with gr.Column(scale=2):
|
59 |
+
text_output = gr.Textbox(show_label=False, placeholder="Здравствуйте! Чем я могу Вам помочь сегодня?")
|
60 |
|
61 |
text_button.click(generate, inputs=[promt, model, max_tokens], outputs=text_output)
|
62 |
|