Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -105,13 +105,8 @@ with tab1:
|
|
| 105 |
uploaded_file = st.file_uploader("Choose a CSV file", type="csv")
|
| 106 |
|
| 107 |
|
| 108 |
-
# Load the CSV file
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
|
| 114 |
-
# Check
|
| 115 |
if uploaded_file is None:
|
| 116 |
st.warning("Please upload a CSV file.")
|
| 117 |
|
|
@@ -155,25 +150,19 @@ with tab1:
|
|
| 155 |
|
| 156 |
|
| 157 |
with tab2:
|
| 158 |
-
|
| 159 |
-
st.write("Ask questions about news content and get answers from our AI model.")
|
| 160 |
-
|
| 161 |
-
# Option to upload file or enter text manually
|
| 162 |
-
input_option = st.radio("Choose input method:", ("Upload CSV", "Enter Text Manually"))
|
| 163 |
|
| 164 |
-
context = ""
|
| 165 |
|
| 166 |
-
if
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
else:
|
| 173 |
-
context = ' '.join(qa_df['excerpt'].tolist())
|
| 174 |
-
st.write(f"Loaded {len(qa_df)} news excerpts")
|
| 175 |
else:
|
| 176 |
-
|
|
|
|
| 177 |
|
| 178 |
question = st.text_input("Enter your question:")
|
| 179 |
|
|
|
|
| 105 |
uploaded_file = st.file_uploader("Choose a CSV file", type="csv")
|
| 106 |
|
| 107 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
|
| 109 |
+
# Check the file
|
| 110 |
if uploaded_file is None:
|
| 111 |
st.warning("Please upload a CSV file.")
|
| 112 |
|
|
|
|
| 150 |
|
| 151 |
|
| 152 |
with tab2:
|
| 153 |
+
st.header("Question Answering Pipeline")
|
| 154 |
+
st.write("Ask questions about news content and get answers from our AI model.")
|
|
|
|
|
|
|
|
|
|
| 155 |
|
|
|
|
| 156 |
|
| 157 |
+
if qa_file is not None:
|
| 158 |
+
qa_df = uploaded_file
|
| 159 |
+
|
| 160 |
+
context = ' '.join(qa_df['predicted_category'].tolist())
|
| 161 |
+
st.write(f"Loaded {len(qa_df)} news excerpts")
|
| 162 |
+
|
|
|
|
|
|
|
|
|
|
| 163 |
else:
|
| 164 |
+
st.warning("Please upload a CSV file.")
|
| 165 |
+
|
| 166 |
|
| 167 |
question = st.text_input("Enter your question:")
|
| 168 |
|