Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -5,9 +5,6 @@ import os
|
|
5 |
import time
|
6 |
|
7 |
def generate(description, model, max_tokens):
|
8 |
-
if not description:
|
9 |
-
return "Введите запрос"
|
10 |
-
|
11 |
headers = {
|
12 |
'Content-Type': 'application/json',
|
13 |
'Authorization': f'Bearer {os.getenv("API_KEY")}'
|
@@ -33,11 +30,10 @@ def generate(description, model, max_tokens):
|
|
33 |
else:
|
34 |
print(f'Не удалось сгенерировать текст. Повторная попытка...')
|
35 |
time.sleep(1)
|
36 |
-
|
37 |
iface = gr.Interface(fn=generate, inputs=[
|
38 |
gr.Textbox(label="Запрос"),
|
39 |
gr.Radio(show_label=True, label="Модель", interactive=True, choices=["gpt-3.5-turbo", "gpt-3.5-turbo-16k"], value="gpt-3.5-turbo"),
|
40 |
gr.Slider(show_label=True, label="Максимум токенов", minimum=100, maximum=15000, value=10000, step=1)
|
41 |
], outputs=gr.Textbox(label="Ответ"))
|
42 |
-
|
43 |
-
iface.launch(share=True, live=True, inline=False, debug=True, blocking=True)
|
|
|
5 |
import time
|
6 |
|
7 |
def generate(description, model, max_tokens):
|
|
|
|
|
|
|
8 |
headers = {
|
9 |
'Content-Type': 'application/json',
|
10 |
'Authorization': f'Bearer {os.getenv("API_KEY")}'
|
|
|
30 |
else:
|
31 |
print(f'Не удалось сгенерировать текст. Повторная попытка...')
|
32 |
time.sleep(1)
|
33 |
+
|
34 |
iface = gr.Interface(fn=generate, inputs=[
|
35 |
gr.Textbox(label="Запрос"),
|
36 |
gr.Radio(show_label=True, label="Модель", interactive=True, choices=["gpt-3.5-turbo", "gpt-3.5-turbo-16k"], value="gpt-3.5-turbo"),
|
37 |
gr.Slider(show_label=True, label="Максимум токенов", minimum=100, maximum=15000, value=10000, step=1)
|
38 |
], outputs=gr.Textbox(label="Ответ"))
|
39 |
+
iface.launch()
|
|