nlpblogs commited on
Commit
4b9f242
·
verified ·
1 Parent(s): da84618

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -16
app.py CHANGED
@@ -13,22 +13,22 @@ st.link_button("by nlpblogs", "https://nlpblogs.com", type = "tertiary")
13
  expander = st.expander("**Important notes on the AI CSV and XLSX Data Analyzer**")
14
  expander.write('''
15
 
16
- **Supported File Formats**
17
  This app accepts files in .csv and .xlsx formats.
18
 
19
- **How to Use**
20
  Upload your file first. Select two different columns from your data to visualize in a tree map. Then, type your question into the text area provided and click the 'Retrieve your answer' button.
21
 
22
- **Usage Limits**
23
  You can ask up to 5 questions.
24
 
25
- **Subscription Management**
26
- This app offers a one-day free trial, followed by a one-day subscription, expiring after 24 hours. If you are interested in building your own Table Question Answering (QA) Web App, we invite you to explore our NLP Web App Store on our website. You can select your desired features, place your order, and we will deliver your custom app in five business days. If you wish to delete your Account with us, please contact us at [email protected]
27
 
28
- **Customization**
29
  To change the app's background color to white or black, click the three-dot menu on the right-hand side of your app, go to Settings and then Choose app theme, colors and fonts.
30
 
31
- **File Handling and Errors**
32
  The app may display an error message if your file has errors or date values.
33
 
34
  For any errors or inquiries, please contact us at [email protected]
@@ -73,7 +73,7 @@ if upload_file is not None:
73
 
74
  if parent_column and value_column:
75
  if parent_column == value_column:
76
- st.warning("Warning: You have selected the same column for both the parent and value column. Please select two different columns from your data.This might not produce a meaningful treemap.")
77
  elif parent_column and value_column:
78
  path_columns = [px.Constant("all"), parent_column, value_column]
79
  fig = px.treemap(df,
@@ -156,14 +156,12 @@ if st.button("Retrieve your answer"):
156
  st.error(f"You have asked {max_attempts} questions. Maximum question attempts reached.")
157
  st.stop()
158
  st.session_state['question_attempts'] += 1
159
- if error_streamlit:
160
- st.warning("Please enter a question before retrieving the answer.")
161
- else:
162
- with st.spinner("Wait for it...", show_time=True):
163
- time.sleep(5)
164
- if df is not None:
165
- tqa = pipeline(task="table-question-answering", model="microsoft/tapex-large-finetuned-wtq")
166
- st.write(tqa(table=df, query=question)['answer'])
167
 
168
  st.divider()
169
  st.write(f"Number of questions asked: {st.session_state['question_attempts']}/{max_attempts}")
 
13
  expander = st.expander("**Important notes on the AI CSV and XLSX Data Analyzer**")
14
  expander.write('''
15
 
16
+ **Supported File Formats:**
17
  This app accepts files in .csv and .xlsx formats.
18
 
19
+ **How to Use:**
20
  Upload your file first. Select two different columns from your data to visualize in a tree map. Then, type your question into the text area provided and click the 'Retrieve your answer' button.
21
 
22
+ **Usage Limits:**
23
  You can ask up to 5 questions.
24
 
25
+ **Subscription Management:**
26
+ This app offers a one-day free trial, followed by a one-day subscription, expiring after 24 hours. If you are interested in building your own AI CSV and XLSX Data Analyzer, we invite you to explore our NLP Web App Store on our website. You can select your desired features, place your order, and we will deliver your custom app in five business days. If you wish to delete your Account with us, please contact us at [email protected]
27
 
28
+ **Customization:**
29
  To change the app's background color to white or black, click the three-dot menu on the right-hand side of your app, go to Settings and then Choose app theme, colors and fonts.
30
 
31
+ **File Handling and Errors:**
32
  The app may display an error message if your file has errors or date values.
33
 
34
  For any errors or inquiries, please contact us at [email protected]
 
73
 
74
  if parent_column and value_column:
75
  if parent_column == value_column:
76
+ st.warning("Warning: You have selected the same column for both the parent and value column. Please select two different columns from your data.")
77
  elif parent_column and value_column:
78
  path_columns = [px.Constant("all"), parent_column, value_column]
79
  fig = px.treemap(df,
 
156
  st.error(f"You have asked {max_attempts} questions. Maximum question attempts reached.")
157
  st.stop()
158
  st.session_state['question_attempts'] += 1
159
+
160
+ with st.spinner("Wait for it...", show_time=True):
161
+ time.sleep(5)
162
+ if df is not None:
163
+ tqa = pipeline(task="table-question-answering", model="microsoft/tapex-large-finetuned-wtq")
164
+ st.write(tqa(table=df, query=question)['answer'])
 
 
165
 
166
  st.divider()
167
  st.write(f"Number of questions asked: {st.session_state['question_attempts']}/{max_attempts}")