Keeby-smilyai commited on
Commit
31038ad
·
verified ·
1 Parent(s): 13bfc1e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -39,7 +39,7 @@ def process_uploaded_dataset(uploaded_file):
39
  to the Hugging Face dataset repository.
40
  """
41
  if not HF_TOKEN:
42
- return "Error: HF_TOKEN is not set in this Space's secrets. Cannot upload data."
43
 
44
  if uploaded_file is None:
45
  return "Error: No file was uploaded. Please select a .jsonl file."
@@ -102,6 +102,9 @@ def process_uploaded_dataset(uploaded_file):
102
 
103
  # --- Gradio User Interface ---
104
  with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue")) as demo:
 
 
 
105
  gr.Markdown(f"""
106
  # CONTRIBUTOR SPACE for Open Sam Chat
107
  ## Add Data to `{DATASET_REPO}`
@@ -116,10 +119,11 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue")) as demo:
116
 
117
  **Example of a valid `.jsonl` file:**
118
  ```json
119
- {"prompt": "What is the capital of France?", "response": "The capital of France is Paris."}
120
- {"prompt": "Explain the concept of photosynthesis in simple terms.", "response": "Photosynthesis is the process plants use to turn sunlight, water, and air into food for themselves."}
121
  ```
122
  """)
 
123
 
124
  with gr.Row():
125
  file_uploader = gr.File(
 
39
  to the Hugging Face dataset repository.
40
  """
41
  if not HF_TOKEN:
42
+ return "Error: HF_TOKEN is not set in this Space's secrets. Cannot upload data. Please add the secret in the repository settings."
43
 
44
  if uploaded_file is None:
45
  return "Error: No file was uploaded. Please select a .jsonl file."
 
102
 
103
  # --- Gradio User Interface ---
104
  with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue")) as demo:
105
+ # --- FIX IS HERE ---
106
+ # The literal curly braces { and } in the JSON example have been doubled to {{ and }}
107
+ # to escape them within the f-string.
108
  gr.Markdown(f"""
109
  # CONTRIBUTOR SPACE for Open Sam Chat
110
  ## Add Data to `{DATASET_REPO}`
 
119
 
120
  **Example of a valid `.jsonl` file:**
121
  ```json
122
+ {{"prompt": "What is the capital of France?", "response": "The capital of France is Paris."}}
123
+ {{"prompt": "Explain the concept of photosynthesis in simple terms.", "response": "Photosynthesis is the process plants use to turn sunlight, water, and air into food for themselves."}}
124
  ```
125
  """)
126
+ # --- END OF FIX ---
127
 
128
  with gr.Row():
129
  file_uploader = gr.File(