eogreen commited on
Commit
0953097
·
verified ·
1 Parent(s): c42bfdd

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -25,7 +25,7 @@ model_name = 'gpt-4o-mini' # e.g. 'gpt-3.5-turbo'
25
  # Initialize the ChatOpenAI model
26
  llm = ChatOpenAI(model_name=model_name, temperature=0) # Set temperature to 0 for deterministic output
27
  # Create a HumanMessage
28
- user_message = HumanMessage(content="What's the weather like today?")
29
 
30
  # Define the embedding model and the vectorstore
31
  embedding_model = SentenceTransformerEmbeddings(model_name='thenlper/gte-large')
@@ -127,7 +127,8 @@ def llm_query(user_input,company):
127
  # temperature=0
128
  # )
129
 
130
- llm_response = response.choices[0].message.content.strip()
 
131
 
132
  except Exception as e:
133
 
@@ -153,12 +154,12 @@ def llm_query(user_input,company):
153
  return llm_response
154
 
155
  # Set-up the Gradio UI
156
- company = gr.Radio(label='Company:', choices=["aws", "google", "ibm", "meta", "microsoft"], value="aws") # Create a radio button for company selection
157
  textbox = gr.Textbox(label='Question:') # Create a textbox for user input
 
158
 
159
  # Create Gradio interface
160
  # For the inputs parameter of Interface provide [textbox,company] with outputs parameter of Interface provide prediction
161
  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.")
162
 
163
  demo.queue()
164
- demo.launch()
 
25
  # Initialize the ChatOpenAI model
26
  llm = ChatOpenAI(model_name=model_name, temperature=0) # Set temperature to 0 for deterministic output
27
  # Create a HumanMessage
28
+ #user_message = HumanMessage(content="What's the weather like today?")
29
 
30
  # Define the embedding model and the vectorstore
31
  embedding_model = SentenceTransformerEmbeddings(model_name='thenlper/gte-large')
 
127
  # temperature=0
128
  # )
129
 
130
+ #llm_response = response.choices[0].message.content.strip()
131
+ llm_response = response.content.strip()
132
 
133
  except Exception as e:
134
 
 
154
  return llm_response
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", "microsoft"], 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.")
163
 
164
  demo.queue()
165
+ demo.launch()