Update app.py
Browse files
app.py
CHANGED
@@ -22,13 +22,37 @@ def invoke(openai_api_key, task):
|
|
22 |
del os.environ["OPENAI_API_KEY"]
|
23 |
return result
|
24 |
|
|
|
|
|
|
|
25 |
gr.close_all()
|
26 |
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
|
34 |
-
|
|
|
22 |
del os.environ["OPENAI_API_KEY"]
|
23 |
return result
|
24 |
|
25 |
+
def clear():
|
26 |
+
return ""
|
27 |
+
|
28 |
gr.close_all()
|
29 |
|
30 |
+
with gr.Blocks() as assistant:
|
31 |
+
gr.Markdown("## Multi-Agent AI: Coding")
|
32 |
+
gr.Markdown(os.environ.get("DESCRIPTION"))
|
33 |
+
|
34 |
+
with gr.Row():
|
35 |
+
with gr.Column(scale=1):
|
36 |
+
with gr.Row():
|
37 |
+
openai_api_key = gr.Textbox(label = "OpenAI API Key", type = "password", lines = 1)
|
38 |
+
task = gr.Textbox(label = "Task", value=os.environ["INPUT"], lines = 1)
|
39 |
+
with gr.Row():
|
40 |
+
clear_btn = gr.ClearButton(
|
41 |
+
components=[openai_api_key, task]
|
42 |
+
)
|
43 |
+
submit_btn = gr.Button("Submit", variant="primary")
|
44 |
+
with gr.Column(scale=3):
|
45 |
+
output = gr.Markdown(label = "Output", value=os.environ["OUTPUT"], line_breaks = True, sanitize_html = False)
|
46 |
+
|
47 |
+
clear_btn.click(
|
48 |
+
fn=clear,
|
49 |
+
outputs=output
|
50 |
+
)
|
51 |
+
|
52 |
+
submit_btn.click(
|
53 |
+
fn=invoke,
|
54 |
+
inputs=[openai_api_key, task],
|
55 |
+
outputs=article
|
56 |
+
)
|
57 |
|
58 |
+
assistant.launch()
|