Gilvan commited on
Commit
744a36c
·
verified ·
1 Parent(s): e62171b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -10
app.py CHANGED
@@ -1,16 +1,10 @@
1
- import os
2
- from huggingface_hub import login
3
  import torch
 
4
  from transformers import pipeline
5
  import gradio as gr
6
 
7
- # Set the Hugging Face token from the environment variable
8
- hf_token = os.getenv("HF_TOKEN")
9
- if hf_token is None:
10
- raise ValueError("Hugging Face token is not set in the environment variable.")
11
-
12
- # Log in to Hugging Face with the token
13
- login(token=hf_token)
14
 
15
  # Define the model ID
16
  model_id = "meta-llama/Llama-3.2-1B-Instruct"
@@ -41,4 +35,4 @@ iface = gr.Interface(
41
  )
42
 
43
  # Launch the Gradio app
44
- iface.launch()
 
 
 
1
  import torch
2
+ from huggingface_hub import login
3
  from transformers import pipeline
4
  import gradio as gr
5
 
6
+ # Log in to Hugging Face (this will use the token stored from huggingface-cli login)
7
+ login()
 
 
 
 
 
8
 
9
  # Define the model ID
10
  model_id = "meta-llama/Llama-3.2-1B-Instruct"
 
35
  )
36
 
37
  # Launch the Gradio app
38
+ iface.launch()