Cylanoid commited on
Commit
9f75433
·
verified ·
1 Parent(s): b5fd96f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -14,13 +14,13 @@ import sentencepiece
14
  import huggingface_hub
15
  from transformers import TrainingArguments, Trainer
16
 
17
- # Retrieve HF_TOKEN from Hugging Face Space secrets
18
- HF_TOKEN = os.getenv("HF_TOKEN:levi put token here") # Token expected as env variable 'HF_TOKEN'
19
- if not HF_TOKEN:
20
- raise ValueError("HF_TOKEN not found in environment variables. Please set it in Hugging Face Space secrets under 'Settings' > 'Secrets'.")
21
 
22
  # Authenticate with Hugging Face
23
- huggingface_hub.login(token=HF_TOKEN)
24
 
25
  # Model setup
26
  MODEL_ID = "meta-llama/Llama-2-7b-hf"
@@ -143,7 +143,7 @@ def train_ui(files):
143
  return "Training completed! Model saved to ./fine_tuned_llama_healthcare"
144
 
145
  except Exception as e:
146
- return f"Error: {str(e)}. Please check file format, dependencies, or HF_TOKEN."
147
 
148
  # Gradio UI
149
  with gr.Blocks(title="Healthcare Fraud Detection Fine-Tuning") as demo:
 
14
  import huggingface_hub
15
  from transformers import TrainingArguments, Trainer
16
 
17
+ # Retrieve the token from Hugging Face Space secrets
18
+ llama = os.getenv("llama:levi put token here") # Token expected as env variable 'llama'
19
+ if not llama:
20
+ raise ValueError("llama token not found in environment variables. Please set it in Hugging Face Space secrets under 'Settings' > 'Secrets' as 'llama'.")
21
 
22
  # Authenticate with Hugging Face
23
+ huggingface_hub.login(token=llama)
24
 
25
  # Model setup
26
  MODEL_ID = "meta-llama/Llama-2-7b-hf"
 
143
  return "Training completed! Model saved to ./fine_tuned_llama_healthcare"
144
 
145
  except Exception as e:
146
+ return f"Error: {str(e)}. Please check file format, dependencies, or the llama token."
147
 
148
  # Gradio UI
149
  with gr.Blocks(title="Healthcare Fraud Detection Fine-Tuning") as demo: