andreska commited on
Commit
e7169f6
·
verified ·
1 Parent(s): b0c57d4

Reverted trying to not load dataset, as it causes problem with requests

Browse files
Files changed (1) hide show
  1. app.py +12 -14
app.py CHANGED
@@ -7,6 +7,18 @@ from huggingface_hub import InferenceClient
7
  api_key = os.getenv("HF_API_KEY")
8
  client = InferenceClient(api_key=api_key)
9
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  # Inject custom CSS to change the background color to yellow
11
  st.markdown(
12
  """
@@ -27,20 +39,6 @@ if 'conversation' not in st.session_state:
27
  if 'include_context' not in st.session_state:
28
  st.session_state.include_context = False
29
 
30
- if include_context:
31
- dataset = load_dataset("andreska/adregadocs", split="test")
32
-
33
- # Function to read the content from the dataset
34
- def read_dataset(dataset):
35
- text = []
36
- for item in dataset:
37
- text.append(item['text'])
38
- return "\n".join(text)
39
-
40
- context = read_dataset(dataset)
41
- else:
42
- context = ""
43
-
44
  def handle_submit():
45
  user_input = st.session_state.user_input
46
  if user_input:
 
7
  api_key = os.getenv("HF_API_KEY")
8
  client = InferenceClient(api_key=api_key)
9
 
10
+ # Load the dataset
11
+ dataset = load_dataset("andreska/adregadocs", split="test")
12
+
13
+ # Function to read the content from the dataset
14
+ def read_dataset(dataset):
15
+ text = []
16
+ for item in dataset:
17
+ text.append(item['text'])
18
+ return "\n".join(text)
19
+
20
+ context = read_dataset(dataset)
21
+
22
  # Inject custom CSS to change the background color to yellow
23
  st.markdown(
24
  """
 
39
  if 'include_context' not in st.session_state:
40
  st.session_state.include_context = False
41
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  def handle_submit():
43
  user_input = st.session_state.user_input
44
  if user_input: