File size: 1,129 Bytes
f92a51b
 
 
d8abe74
 
 
 
 
 
 
 
 
37cbee2
 
d8abe74
 
10954e8
d8abe74
10954e8
fd57461
10954e8
d8abe74
32a7af3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import gradio as gr
import requests

def minecraft_command(description):
    url = "https://copilot.github1s.tk/"
    headers = {
        "Authorization": "Bearer dummy",
        "Content-Type": "application/json"
    }
    prompt = f'Напиши пожалуйста команду для Minecraft JAVA 1.20, под описание: "{description}". Если там не пойми что, или ты не можешь сделать такую команду или её не существубт, очень кратко скажи об этом. Пиши только команду, без лишнего текста.'
    json_data = {
        "prompt": prompt,
        "max_tokens": 100,
        "model": "gpt-3.5-turbo"
    }
    response = requests.post(url, headers=headers, json=json_data)
    if response.status_code == 200:
        return response.json()["choices"][0]["text"].strip()
    else:
        return "Произошла ошибка при отправке запроса."

iface = gr.Interface(fn=minecraft_command, inputs="text", outputs="text", title="Minecraft Command Generator")
iface.launch()