Upload app.py
Browse files
app.py
CHANGED
@@ -108,12 +108,12 @@ def llm_query(user_input,company):
|
|
108 |
|
109 |
# 2 - Create messages
|
110 |
prompt = [
|
111 |
-
|
112 |
-
|
113 |
context=context_for_query,
|
114 |
question=user_input
|
115 |
)
|
116 |
-
|
117 |
]
|
118 |
|
119 |
# Get response from the LLM
|
@@ -155,11 +155,11 @@ def llm_query(user_input,company):
|
|
155 |
|
156 |
# Set-up the Gradio UI
|
157 |
textbox = gr.Textbox(label='Question:') # Create a textbox for user input
|
158 |
-
company = gr.Radio(label='Company:', choices=["aws", "google", "
|
159 |
|
160 |
# Create Gradio interface
|
161 |
# For the inputs parameter of Interface provide [textbox,company] with outputs parameter of Interface provide prediction
|
162 |
-
demo = gr.Interface(fn=llm_query, inputs=[textbox, company], outputs="text", title="Financial Analyst Assistant", description="Ask questions about the financial performance of AWS, Google, IBM, Meta, and Microsoft based on their 10-K reports.\n\nPlease enter a question below.")
|
163 |
|
164 |
demo.queue()
|
165 |
demo.launch()
|
|
|
108 |
|
109 |
# 2 - Create messages
|
110 |
prompt = [
|
111 |
+
SystemMessage(content=qna_system_message),
|
112 |
+
HumanMessage(content=qna_user_message_template.format(
|
113 |
context=context_for_query,
|
114 |
question=user_input
|
115 |
)
|
116 |
+
)
|
117 |
]
|
118 |
|
119 |
# Get response from the LLM
|
|
|
155 |
|
156 |
# Set-up the Gradio UI
|
157 |
textbox = gr.Textbox(label='Question:') # Create a textbox for user input
|
158 |
+
company = gr.Radio(label='Company:', choices=["aws", "google", "IBM", "Meta", "msft"], value="aws") # Create a radio button for company selection
|
159 |
|
160 |
# Create Gradio interface
|
161 |
# For the inputs parameter of Interface provide [textbox,company] with outputs parameter of Interface provide prediction
|
162 |
+
demo = gr.Interface(fn=llm_query, inputs=[textbox, company], outputs="text", title="Financial Analyst Assistant", description="Ask questions about the financial performance of AWS, Google, IBM, Meta, and Microsoft based on their 10-K reports.\n\nPlease enter a question below.", theme=gr.themes.Soft())
|
163 |
|
164 |
demo.queue()
|
165 |
demo.launch()
|