Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -120,9 +120,9 @@ if uploaded_file:
|
|
120 |
]
|
121 |
}
|
122 |
|
123 |
-
predefined_q = st.selectbox("Choose a predefined question
|
124 |
-
manual_q = st.text_input("Or type your own question below:")
|
125 |
-
question = manual_q
|
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 |
-
|
|
|
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.")
|
|