Update app.py
Browse files
    	
        app.py
    CHANGED
    
    | 
         @@ -5,11 +5,12 @@ from multi_agent import run_multi_agent 
     | 
|
| 5 | 
         | 
| 6 | 
         
             
            lock = threading.Lock()
         
     | 
| 7 | 
         | 
| 8 | 
         
            -
            LLM = "gpt-4o"
         
     | 
| 9 | 
         | 
| 10 | 
         
            -
            def invoke( 
     | 
| 11 | 
         
            -
                if not  
     | 
| 12 | 
         
            -
             
     | 
| 
         | 
|
| 13 | 
         | 
| 14 | 
         
             
                if not task:
         
     | 
| 15 | 
         
             
                    raise gr.Error("Task is required.")
         
     | 
| 
         @@ -17,15 +18,15 @@ def invoke(openai_api_key, task): 
     | 
|
| 17 | 
         
             
                raise gr.Error("Please clone space due to local code execution.")
         
     | 
| 18 | 
         | 
| 19 | 
         
             
                with lock:
         
     | 
| 20 | 
         
            -
                    os.environ[" 
     | 
| 21 | 
         
             
                    result = run_multi_agent(LLM, task)
         
     | 
| 22 | 
         
            -
                    del os.environ[" 
     | 
| 23 | 
         
             
                    return result
         
     | 
| 24 | 
         | 
| 25 | 
         
             
            gr.close_all()
         
     | 
| 26 | 
         | 
| 27 | 
         
             
            demo = gr.Interface(fn = invoke, 
         
     | 
| 28 | 
         
            -
                                inputs = [gr.Textbox(label = " 
     | 
| 29 | 
         
             
                                          gr.Textbox(label = "Task", value = os.environ['INPUT'])],
         
     | 
| 30 | 
         
             
                                outputs = [gr.Markdown(label = "Output", value = os.environ["OUTPUT"], line_breaks = True, sanitize_html = False)],
         
     | 
| 31 | 
         
             
                                title = "Multi-Agent AI: Coding",
         
     | 
| 
         | 
|
| 5 | 
         | 
| 6 | 
         
             
            lock = threading.Lock()
         
     | 
| 7 | 
         | 
| 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 | 
         
            +
                     raise gr.Error("Groq API Key is required.")
         
     | 
| 14 | 
         | 
| 15 | 
         
             
                if not task:
         
     | 
| 16 | 
         
             
                    raise gr.Error("Task is required.")
         
     | 
| 
         | 
|
| 18 | 
         
             
                raise gr.Error("Please clone space due to local code execution.")
         
     | 
| 19 | 
         | 
| 20 | 
         
             
                with lock:
         
     | 
| 21 | 
         
            +
                    os.environ["GROQ_API_KEY"] = groq_api_key
         
     | 
| 22 | 
         
             
                    result = run_multi_agent(LLM, task)
         
     | 
| 23 | 
         
            +
                    del os.environ["GROQ_API_KEY"]
         
     | 
| 24 | 
         
             
                    return result
         
     | 
| 25 | 
         | 
| 26 | 
         
             
            gr.close_all()
         
     | 
| 27 | 
         | 
| 28 | 
         
             
            demo = gr.Interface(fn = invoke, 
         
     | 
| 29 | 
         
            +
                                inputs = [gr.Textbox(label = "GROQ API KEY", type = "password", lines = 1),
         
     | 
| 30 | 
         
             
                                          gr.Textbox(label = "Task", value = os.environ['INPUT'])],
         
     | 
| 31 | 
         
             
                                outputs = [gr.Markdown(label = "Output", value = os.environ["OUTPUT"], line_breaks = True, sanitize_html = False)],
         
     | 
| 32 | 
         
             
                                title = "Multi-Agent AI: Coding",
         
     |