Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -30,13 +30,37 @@ def invoke(openai_api_key, topic):
|
|
30 |
|
31 |
return article
|
32 |
|
|
|
|
|
|
|
33 |
gr.close_all()
|
34 |
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
|
42 |
-
|
|
|
30 |
|
31 |
return article
|
32 |
|
33 |
+
def clear():
|
34 |
+
return ""
|
35 |
+
|
36 |
gr.close_all()
|
37 |
|
38 |
+
with gr.Blocks(title="Multi-Agent AI") as assistant:
|
39 |
+
gr.Markdown("## Multi-Agent AI: Article Writing")
|
40 |
+
gr.Markdown(os.environ.get("DESCRIPTION"))
|
41 |
+
|
42 |
+
with gr.Row():
|
43 |
+
with gr.Column(scale=1):
|
44 |
+
with gr.Row():
|
45 |
+
openai_api_key = gr.Textbox(label = "OpenAI API Key", type = "password", lines = 1)
|
46 |
+
topic = gr.Textbox(label = "Topic", value=os.environ["TOPIC"], lines = 1)
|
47 |
+
with gr.Row():
|
48 |
+
clear_btn = gr.ClearButton(
|
49 |
+
components=[openai_api_key, topic]
|
50 |
+
)
|
51 |
+
submit_btn = gr.Button("Submit", variant="primary")
|
52 |
+
with gr.Column(scale=3):
|
53 |
+
article = gr.Markdown(label = "Article", value=os.environ["OUTPUT"], line_breaks = True, sanitize_html = False)
|
54 |
+
|
55 |
+
clear_btn.click(
|
56 |
+
fn=clear,
|
57 |
+
outputs=article
|
58 |
+
)
|
59 |
+
|
60 |
+
submit_btn.click(
|
61 |
+
fn=invoke,
|
62 |
+
inputs=[openai_api_key, topic],
|
63 |
+
outputs=article
|
64 |
+
)
|
65 |
|
66 |
+
assistant.launch()
|