eogreen commited on
Commit
6f6d6d7
1 Parent(s): 49e917f

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -6
app.py CHANGED
@@ -22,7 +22,6 @@ llm_client = OpenAI()
22
  # Define the embedding model and the vectorstore
23
  embedding_model = SentenceTransformerEmbeddings(model_name='thenlper/gte-large')
24
 
25
- # Load the persisted vectorDB
26
  vectorstore_persisted = Chroma(
27
  collection_name='10k_reports',
28
  persist_directory='10k_reports_db',
@@ -117,7 +116,7 @@ def llm_query(user_input,company):
117
  temperature=0
118
  )
119
 
120
- prediction = response.choices[0].message.content.strip()
121
 
122
  except Exception as e:
123
 
@@ -135,16 +134,16 @@ def llm_query(user_input,company):
135
  {
136
  'user_input': user_input,
137
  'retrieved_context': context_for_query,
138
- 'model_response': prediction
139
  }
140
  ))
141
  f.write("\n")
142
 
143
- return prediction
144
 
145
  # Set-up the Gradio UI
146
- company = gr.Radio(Label='Company:', choices=["aws", "google", "ibm", "meta", "microsoft"]) # Create a radio button for company selection
147
- textbox = gr.Textbox(Label='Question:') # Create a textbox for user input
148
 
149
  # Create Gradio interface
150
  # For the inputs parameter of Interface provide [textbox,company] with outputs parameter of Interface provide prediction
 
22
  # Define the embedding model and the vectorstore
23
  embedding_model = SentenceTransformerEmbeddings(model_name='thenlper/gte-large')
24
 
 
25
  vectorstore_persisted = Chroma(
26
  collection_name='10k_reports',
27
  persist_directory='10k_reports_db',
 
116
  temperature=0
117
  )
118
 
119
+ llm_response = response.choices[0].message.content.strip()
120
 
121
  except Exception as e:
122
 
 
134
  {
135
  'user_input': user_input,
136
  'retrieved_context': context_for_query,
137
+ 'model_response': llm_response
138
  }
139
  ))
140
  f.write("\n")
141
 
142
+ return llm_response
143
 
144
  # Set-up the Gradio UI
145
+ company = gr.Radio(label='Company:', choices=["aws", "google", "ibm", "meta", "microsoft"]) # Create a radio button for company selection
146
+ textbox = gr.Textbox(label='Question:') # Create a textbox for user input
147
 
148
  # Create Gradio interface
149
  # For the inputs parameter of Interface provide [textbox,company] with outputs parameter of Interface provide prediction