guillermo2323 commited on
Commit
183de92
verified
1 Parent(s): 301e787

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +16 -19
README.md CHANGED
@@ -1,23 +1,20 @@
1
- ---
2
- title: Alia
3
- emoji: 馃挰
4
- colorFrom: yellow
5
- colorTo: purple
6
- sdk: gradio
7
- sdk_version: 5.0.1
8
- app_file: app.py
9
- pinned: false
10
- license: apache-2.0
11
- short_description: Alia
12
 
13
- from transformers import pipeline
 
 
14
 
15
- # Cargar el pipeline de generaci贸n de texto con el modelo Alia
16
- pipe = pipeline("text-generation", model="BSC-LT/ALIA-40b")
 
 
 
 
17
 
18
- # Generar texto
19
- texto_generado = pipe("Introduce el texto inicial aqu铆", max_length=100, num_return_sequences=1)
20
- print(texto_generado)
21
 
22
-
23
- An example chatbot using [Gradio](https://gradio.app), [`huggingface_hub`](https://huggingface.co/docs/huggingface_hub/v0.22.2/en/index), and the [Hugging Face Inference API](https://huggingface.co/docs/api-inference/index).
 
 
1
+ import gradio as gr
2
+ from transformers import AutoTokenizer, AutoModelForCausalLM
 
 
 
 
 
 
 
 
 
3
 
4
+ # Cargar el tokenizador y el modelo
5
+ tokenizer = AutoTokenizer.from_pretrained("BSC-LT/ALIA-40b")
6
+ model = AutoModelForCausalLM.from_pretrained("BSC-LT/ALIA-40b")
7
 
8
+ # Definir la funci贸n de generaci贸n de texto
9
+ def generar_texto(entrada):
10
+ inputs = tokenizer(entrada, return_tensors="pt")
11
+ outputs = model.generate(**inputs, max_length=100)
12
+ texto_generado = tokenizer.decode(outputs[0], skip_special_tokens=True)
13
+ return texto_generado
14
 
15
+ # Crear la interfaz de Gradio
16
+ interfaz = gr.Interface(fn=generar_texto, inputs="text", outputs="text", title="Alia Chatbot")
 
17
 
18
+ # Ejecutar la aplicaci贸n
19
+ if __name__ == "__main__":
20
+ interfaz.launch()