JeanCGuerrero commited on
Commit
ce3afb2
verified
1 Parent(s): 365569c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -20,11 +20,11 @@ with open("Manual_de_nutrici贸n_clinica.pdf", "wb") as f:
20
  f.write(response.content)
21
 
22
  # Paso 2: Inicializar el modelo usando Hugging Face Pipeline
23
- # Nota: Si no tienes acceso a llama3.2:1b, reempl谩zalo por otro modelo de HF, como "distilbert-base-uncased"
24
  llm = HuggingFacePipeline.from_model_id(
25
- model_id="distilbert-base-uncased", # Cambia por el modelo al que tengas acceso
26
  task="text-generation",
27
- pipeline_kwargs={"temperature": 0, "top_k": 50, "top_p": 0.95, "max_length": 512}
28
  )
29
  chain = llm | StrOutputParser()
30
 
@@ -72,8 +72,8 @@ interface = gr.Interface(
72
  inputs=gr.Textbox(label="Ingresa tu pregunta sobre nutrici贸n:"),
73
  outputs=gr.Textbox(label="Respuesta:"),
74
  title="Respuesta a Preguntas sobre Nutrici贸n",
75
- description="Haz preguntas sobre nutrici贸n basadas en el Manual B谩sico de Nutrici贸n Cl铆nica y Diet茅tica"
76
  )
77
 
78
  # Lanzar la interfaz
79
- interface.launch()
 
20
  f.write(response.content)
21
 
22
  # Paso 2: Inicializar el modelo usando Hugging Face Pipeline
23
+ # Usamos gpt2 en lugar de distilbert-base-uncased
24
  llm = HuggingFacePipeline.from_model_id(
25
+ model_id="gpt2", # Cambiado a gpt2, que es compatible con AutoModelForCausalLM
26
  task="text-generation",
27
+ pipeline_kwargs={"temperature": 0.7, "top_k": 50, "top_p": 0.95, "max_length": 512}
28
  )
29
  chain = llm | StrOutputParser()
30
 
 
72
  inputs=gr.Textbox(label="Ingresa tu pregunta sobre nutrici贸n:"),
73
  outputs=gr.Textbox(label="Respuesta:"),
74
  title="Respuesta a Preguntas sobre Nutrici贸n",
75
+ description="Haz preguntas sobre nutrici贸n basadas en el Manual B谩sico de Nutrici贸n Cl铆nica y Diet茅tica."
76
  )
77
 
78
  # Lanzar la interfaz
79
+ interface.launch()