bhagwandas commited on
Commit
d53f767
Β·
verified Β·
1 Parent(s): a75c2d4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -120,9 +120,9 @@ if uploaded_file:
120
  ]
121
  }
122
 
123
- predefined_q = st.selectbox("Choose a predefined question (optional)", ["None"] + predefined_qas[role])
124
- manual_q = st.text_input("Or type your own question below:")
125
- question = manual_q if manual_q.strip() else (predefined_q if predefined_q != "None" else "")
126
 
127
  if question:
128
  with st.spinner("Generating insights..."):
@@ -147,7 +147,8 @@ QUESTION: {question}
147
  Provide a short, focused response in your role.
148
  """
149
  prompt = f"<s>[INST] {context} [/INST]"
150
- output = nlp(prompt, max_new_tokens=250, do_sample=True, temperature=0.5)[0]['generated_text']
 
151
 
152
  if '[/INST]' in output:
153
  answer = output.split('[/INST]')[-1].strip()
@@ -159,4 +160,3 @@ Provide a short, focused response in your role.
159
 
160
  else:
161
  st.info("πŸ“‚ Please upload a factory CSV data file to begin analysis.")
162
-
 
120
  ]
121
  }
122
 
123
+ predefined_q = st.selectbox("Choose a predefined question", predefined_qas[role])
124
+ manual_q = st.text_input("Or type your own question below (optional):")
125
+ question = manual_q.strip() if manual_q else predefined_q
126
 
127
  if question:
128
  with st.spinner("Generating insights..."):
 
147
  Provide a short, focused response in your role.
148
  """
149
  prompt = f"<s>[INST] {context} [/INST]"
150
+ result = nlp(prompt, max_new_tokens=250, do_sample=True, temperature=0.5)
151
+ output = result[0]['generated_text']
152
 
153
  if '[/INST]' in output:
154
  answer = output.split('[/INST]')[-1].strip()
 
160
 
161
  else:
162
  st.info("πŸ“‚ Please upload a factory CSV data file to begin analysis.")