Update app.py
Browse files
app.py
CHANGED
|
@@ -8,17 +8,21 @@ lock = threading.Lock()
|
|
| 8 |
LLM = "llama3-8b-8192" #gpt-4o"
|
| 9 |
|
| 10 |
def invoke(groq_api_key, task):
|
| 11 |
-
if not GROQ_API_KEY_defualt:
|
| 12 |
if not groq_api_key:
|
| 13 |
-
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
if not task:
|
| 16 |
raise gr.Error("Task is required.")
|
| 17 |
|
| 18 |
raise gr.Error("Please clone space due to local code execution.")
|
| 19 |
|
| 20 |
with lock:
|
| 21 |
-
|
| 22 |
result = run_multi_agent(LLM, task)
|
| 23 |
del os.environ["GROQ_API_KEY"]
|
| 24 |
return result
|
|
|
|
| 8 |
LLM = "llama3-8b-8192" #gpt-4o"
|
| 9 |
|
| 10 |
def invoke(groq_api_key, task):
|
| 11 |
+
if not os.environ("GROQ_API_KEY_defualt"):
|
| 12 |
if not groq_api_key:
|
| 13 |
+
|
| 14 |
+
raise gr.Error("Groq API Key is required, And get it from here :(https://console.groq.com/keys)")
|
| 15 |
+
else:
|
| 16 |
+
os.environ["GROQ_API_KEY"] = groq_api_key
|
| 17 |
+
else:
|
| 18 |
+
os.environ["GROQ_API_KEY"] = os.environ("GROQ_API_KEY_defualt")
|
| 19 |
if not task:
|
| 20 |
raise gr.Error("Task is required.")
|
| 21 |
|
| 22 |
raise gr.Error("Please clone space due to local code execution.")
|
| 23 |
|
| 24 |
with lock:
|
| 25 |
+
|
| 26 |
result = run_multi_agent(LLM, task)
|
| 27 |
del os.environ["GROQ_API_KEY"]
|
| 28 |
return result
|