Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -3,7 +3,7 @@ import requests
|
|
3 |
import json
|
4 |
import os
|
5 |
|
6 |
-
def
|
7 |
headers = {
|
8 |
'Content-Type': 'application/json',
|
9 |
'Authorization': f'Bearer {os.getenv("API_KEY")}'
|
@@ -25,9 +25,9 @@ def generate_minecraft_command(description):
|
|
25 |
error_message = data['error']['message']
|
26 |
return f'Ошибка: {error_message}'
|
27 |
else:
|
28 |
-
return f'Не удалось сгенерировать
|
29 |
|
30 |
-
iface = gr.Interface(fn=
|
31 |
gr.Textbox(label="Запрос")
|
32 |
], outputs=gr.Textbox(label="Ответ"), title="GPT")
|
33 |
iface.launch()
|
|
|
3 |
import json
|
4 |
import os
|
5 |
|
6 |
+
def generate(description):
|
7 |
headers = {
|
8 |
'Content-Type': 'application/json',
|
9 |
'Authorization': f'Bearer {os.getenv("API_KEY")}'
|
|
|
25 |
error_message = data['error']['message']
|
26 |
return f'Ошибка: {error_message}'
|
27 |
else:
|
28 |
+
return f'Не удалось сгенерировать текст. {data}'
|
29 |
|
30 |
+
iface = gr.Interface(fn=generate, inputs=[
|
31 |
gr.Textbox(label="Запрос")
|
32 |
], outputs=gr.Textbox(label="Ответ"), title="GPT")
|
33 |
iface.launch()
|