Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,11 +1,12 @@
|
|
1 |
import gradio as gr
|
2 |
import requests
|
3 |
import json
|
|
|
4 |
|
5 |
def generate_minecraft_command(description):
|
6 |
headers = {
|
7 |
'Content-Type': 'application/json',
|
8 |
-
'Authorization': '
|
9 |
}
|
10 |
|
11 |
payload = {
|
@@ -13,7 +14,7 @@ def generate_minecraft_command(description):
|
|
13 |
'max_tokens': 50
|
14 |
}
|
15 |
|
16 |
-
response = requests.post(
|
17 |
data = json.loads(response.text)
|
18 |
if 'choices' in data and len(data['choices']) > 0:
|
19 |
command = data['choices'][0]['text'].strip()
|
|
|
1 |
import gradio as gr
|
2 |
import requests
|
3 |
import json
|
4 |
+
import os
|
5 |
|
6 |
def generate_minecraft_command(description):
|
7 |
headers = {
|
8 |
'Content-Type': 'application/json',
|
9 |
+
'Authorization': 'Barrer' os.getenv("API_KEY")
|
10 |
}
|
11 |
|
12 |
payload = {
|
|
|
14 |
'max_tokens': 50
|
15 |
}
|
16 |
|
17 |
+
response = requests.post(os.getenv("BASE_URL"), headers=headers, json=payload)
|
18 |
data = json.loads(response.text)
|
19 |
if 'choices' in data and len(data['choices']) > 0:
|
20 |
command = data['choices'][0]['text'].strip()
|