kxx-kkk commited on
Commit
2da57d4
1 Parent(s): 44f06dc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -29,7 +29,10 @@ source = st.radio("How would you upload the essay? Choose an option below", ["I
29
 
30
  sample_question = "What is NLP?"
31
 
32
- if source == "I want to input some text":
 
 
 
33
  with open("sample.txt", "r") as text_file:
34
  sample_text = text_file.read()
35
  context = st.text_area("Use the example below or input your own text in English (10,000 characters max)", value=sample_text, max_chars=10000, height=330)
@@ -43,7 +46,9 @@ if source == "I want to input some text":
43
  answer = answer["answer"]
44
 
45
  st.success(answer)
46
- elif source == "I want to upload a file":
 
 
47
  uploaded_file = st.file_uploader("Choose a .txt file to upload", type=["txt"])
48
  if uploaded_file is not None:
49
  raw_text = str(uploaded_file.read(),"utf-8")
 
29
 
30
  sample_question = "What is NLP?"
31
 
32
+ tab1, tab2 = st.tabs(["Input text", "Upload File"])
33
+
34
+ # if source == "I want to input some text":
35
+ with tab1:
36
  with open("sample.txt", "r") as text_file:
37
  sample_text = text_file.read()
38
  context = st.text_area("Use the example below or input your own text in English (10,000 characters max)", value=sample_text, max_chars=10000, height=330)
 
46
  answer = answer["answer"]
47
 
48
  st.success(answer)
49
+
50
+ # elif source == "I want to upload a file":
51
+ with tab2:
52
  uploaded_file = st.file_uploader("Choose a .txt file to upload", type=["txt"])
53
  if uploaded_file is not None:
54
  raw_text = str(uploaded_file.read(),"utf-8")