Update app.py
Browse files
app.py
CHANGED
@@ -12,7 +12,9 @@ import gradio as gr
|
|
12 |
api_key = os.getenv('OPENAI_API_KEY')
|
13 |
extractor_agents = {
|
14 |
"Solution Specifier A": os.getenv('ASSISTANT_ID_SOLUTION_SPECIFIER_A'),
|
15 |
-
"Solution Specifier
|
|
|
|
|
16 |
}
|
17 |
|
18 |
# Function to create a new extractor LLM instance
|
@@ -45,15 +47,25 @@ def predict(message, history, selected_agent):
|
|
45 |
non_cited_output = remove_citation(output)
|
46 |
return non_cited_output
|
47 |
|
48 |
-
# Define the Gradio interface
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
|
58 |
# Launch the app
|
|
|
59 |
chat_interface.launch(share=True)
|
|
|
12 |
api_key = os.getenv('OPENAI_API_KEY')
|
13 |
extractor_agents = {
|
14 |
"Solution Specifier A": os.getenv('ASSISTANT_ID_SOLUTION_SPECIFIER_A'),
|
15 |
+
"Solution Specifier B": os.getenv('ASSISTANT_ID_SOLUTION_SPECIFIER_B'),
|
16 |
+
"Solution Specifier C": os.getenv('ASSISTANT_ID_SOLUTION_SPECIFIER_C'),
|
17 |
+
"Solution Specifier D": os.getenv('ASSISTANT_ID_SOLUTION_SPECIFIER_D'),
|
18 |
}
|
19 |
|
20 |
# Function to create a new extractor LLM instance
|
|
|
47 |
non_cited_output = remove_citation(output)
|
48 |
return non_cited_output
|
49 |
|
50 |
+
# Define the Gradio interface using Blocks for layout
|
51 |
+
def app_interface():
|
52 |
+
with gr.Blocks() as demo:
|
53 |
+
with gr.Row():
|
54 |
+
dropdown = gr.Dropdown(
|
55 |
+
choices=list(extractor_agents.keys()),
|
56 |
+
value="Solution Specifier A",
|
57 |
+
label="Choose Extractor Agent",
|
58 |
+
interactive=True,
|
59 |
+
)
|
60 |
+
with gr.Row():
|
61 |
+
chat = gr.ChatInterface(
|
62 |
+
fn=predict,
|
63 |
+
additional_inputs=[dropdown],
|
64 |
+
title="Solution Specifier Chat",
|
65 |
+
description="Test with different solution specifiers"
|
66 |
+
)
|
67 |
+
return demo
|
68 |
|
69 |
# Launch the app
|
70 |
+
chat_interface = app_interface()
|
71 |
chat_interface.launch(share=True)
|