JaphetHernandez commited on
Commit
2a0f243
verified
1 Parent(s): 9e42da1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -1,17 +1,17 @@
1
- from transformers import AutoModelForCausalLM, AutoTokenizer
2
  import streamlit as st
3
  from huggingface_hub import login
4
  import pandas as pd
5
  from threading import Thread
6
- import accelerate
7
 
8
- # Token Secret of Hugging Face
9
  huggingface_token = st.secrets["HUGGINGFACEHUB_API_TOKEN"]
10
  login(huggingface_token)
11
 
 
 
12
 
13
- # Cargar el modelo y el tokenizer
14
- model_id = "meta-llama/Meta-Llama-3.1-8B-Instruct"
15
  tokenizer = AutoTokenizer.from_pretrained(model_id)
16
  model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto")
17
  tokenizer.pad_token = tokenizer.eos_token
@@ -44,7 +44,7 @@ def generate_response(input_text, temperature=0.7, max_new_tokens=100):
44
  yield "".join(outputs)
45
 
46
  def main():
47
- st.title("Chat con Meta Llama 3.1 8B")
48
 
49
  # Paso 1: Subir el archivo CSV
50
  uploaded_file = st.file_uploader("Por favor, sube un archivo CSV para iniciar:", type=["csv"])
 
1
+ from transformers import AutoModelForCausalLM, AutoTokenizer, TextIteratorStreamer
2
  import streamlit as st
3
  from huggingface_hub import login
4
  import pandas as pd
5
  from threading import Thread
 
6
 
7
+ # Token Secret de Hugging Face
8
  huggingface_token = st.secrets["HUGGINGFACEHUB_API_TOKEN"]
9
  login(huggingface_token)
10
 
11
+ # Cambiar a la versi贸n Meta Llama 3.1 3B
12
+ model_id = "meta-llama/Meta-Llama-3.1-3B"
13
 
14
+ # Cargar el tokenizador y el modelo
 
15
  tokenizer = AutoTokenizer.from_pretrained(model_id)
16
  model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto")
17
  tokenizer.pad_token = tokenizer.eos_token
 
44
  yield "".join(outputs)
45
 
46
  def main():
47
+ st.title("Chat con Meta Llama 3.1 3B")
48
 
49
  # Paso 1: Subir el archivo CSV
50
  uploaded_file = st.file_uploader("Por favor, sube un archivo CSV para iniciar:", type=["csv"])