Prageeth-1 commited on
Commit
ba3632b
·
verified ·
1 Parent(s): ddc56ef

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -22
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 if 'excerpt' column exists
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
- '''st.header("Question Answering Pipeline")
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 input_option == "Upload CSV":
167
- qa_file = st.file_uploader("Upload news content (CSV)", type="csv")
168
- if qa_file is not None:
169
- qa_df = pd.read_csv(qa_file)
170
- if 'excerpt' not in qa_df.columns:
171
- st.error("CSV must contain an 'excerpt' column")
172
- else:
173
- context = ' '.join(qa_df['excerpt'].tolist())
174
- st.write(f"Loaded {len(qa_df)} news excerpts")
175
  else:
176
- context = st.text_area("Paste news content here:", height=200)
 
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