samiee2213 commited on
Commit
ab98559
·
verified ·
1 Parent(s): 3944d36

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -0
app.py CHANGED
@@ -44,6 +44,13 @@ Instructions:
44
 
45
  Begin extraction.
46
  """
 
 
 
 
 
 
 
47
 
48
  # Set up the page
49
  st.set_page_config(page_title="DataScribe", page_icon=":notebook_with_decorative_cover:", layout="wide")
@@ -134,6 +141,9 @@ elif selected == "Upload Data":
134
  elif selected == "Define Query":
135
  st.header("Define Your Custom Query")
136
 
 
 
 
137
  if st.session_state["data"] is not None:
138
  column_selection = st.selectbox("Select the primary column for entities", options=st.session_state["data"].columns)
139
  query_template = st.text_input("Define your query template", "Get me the email for {company}")
@@ -148,6 +158,10 @@ elif selected == "Define Query":
148
  st.code(example_query)
149
  else:
150
  st.warning("Please upload data first.")
 
 
 
 
151
 
152
  # Extract Information Section with Progress Bar
153
  elif selected == "Extract Information":
 
44
 
45
  Begin extraction.
46
  """
47
+ def get_llm_response(entity, query):
48
+ # Format the prompt with the entity and query
49
+ formatted_prompt = PROMPT_TEMPLATE.format(entity=entity, query=query)
50
+
51
+ # Pass the formatted prompt as a SystemMessage and get the response
52
+ response = llm([SystemMessage(content=formatted_prompt)])
53
+ return response[0].content
54
 
55
  # Set up the page
56
  st.set_page_config(page_title="DataScribe", page_icon=":notebook_with_decorative_cover:", layout="wide")
 
141
  elif selected == "Define Query":
142
  st.header("Define Your Custom Query")
143
 
144
+ entity = st.text_input("Enter the entity name")
145
+ query = st.text_input("Enter the query (e.g., 'contact information for {entity}')")
146
+
147
  if st.session_state["data"] is not None:
148
  column_selection = st.selectbox("Select the primary column for entities", options=st.session_state["data"].columns)
149
  query_template = st.text_input("Define your query template", "Get me the email for {company}")
 
158
  st.code(example_query)
159
  else:
160
  st.warning("Please upload data first.")
161
+ if st.button("Extract Information"):
162
+ if entity and query:
163
+ response_text = get_llm_response(entity, query)
164
+ st.write(reponse_text)
165
 
166
  # Extract Information Section with Progress Bar
167
  elif selected == "Extract Information":