Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
import json
|
| 3 |
-
|
| 4 |
|
| 5 |
def load_config():
|
| 6 |
with open('config.json', 'r') as f:
|
|
@@ -285,7 +285,11 @@ def get_user_input(config):
|
|
| 285 |
}
|
| 286 |
|
| 287 |
def generate_lua_script(params, api_key):
|
| 288 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 289 |
|
| 290 |
if params["custom_prompt"]:
|
| 291 |
prompt = params["custom_prompt"]
|
|
@@ -362,9 +366,13 @@ def generate_lua_script(params, api_key):
|
|
| 362 |
if params["particle_texture"]:
|
| 363 |
prompt += f"35. Adds particle effects with texture ID {params['particle_texture']}, lifetime {params['particle_lifetime']}, rate {params['particle_rate']}, speed {params['particle_speed']}, size {params['particle_size']}, acceleration {params['particle_acceleration']}, rotation speed {params['particle_rot_speed']}, and color {params['particle_color']}.\n"
|
| 364 |
|
| 365 |
-
|
| 366 |
-
|
| 367 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 368 |
|
| 369 |
def main():
|
| 370 |
config = load_config()
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import json
|
| 3 |
+
import requests
|
| 4 |
|
| 5 |
def load_config():
|
| 6 |
with open('config.json', 'r') as f:
|
|
|
|
| 285 |
}
|
| 286 |
|
| 287 |
def generate_lua_script(params, api_key):
|
| 288 |
+
url = "https://api.groq.com/v1/lua_script" # Example URL, replace with actual API endpoint
|
| 289 |
+
headers = {
|
| 290 |
+
"Authorization": f"Bearer {api_key}",
|
| 291 |
+
"Content-Type": "application/json"
|
| 292 |
+
}
|
| 293 |
|
| 294 |
if params["custom_prompt"]:
|
| 295 |
prompt = params["custom_prompt"]
|
|
|
|
| 366 |
if params["particle_texture"]:
|
| 367 |
prompt += f"35. Adds particle effects with texture ID {params['particle_texture']}, lifetime {params['particle_lifetime']}, rate {params['particle_rate']}, speed {params['particle_speed']}, size {params['particle_size']}, acceleration {params['particle_acceleration']}, rotation speed {params['particle_rot_speed']}, and color {params['particle_color']}.\n"
|
| 368 |
|
| 369 |
+
data = {
|
| 370 |
+
"prompt": prompt
|
| 371 |
+
}
|
| 372 |
+
|
| 373 |
+
response = requests.post(url, headers=headers, json=data)
|
| 374 |
+
response.raise_for_status() # Raise an exception for HTTP errors
|
| 375 |
+
return response.json()['script']
|
| 376 |
|
| 377 |
def main():
|
| 378 |
config = load_config()
|