Update app.py
Browse files
app.py
CHANGED
|
@@ -1,11 +1,14 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from huggingface_hub import InferenceClient
|
|
|
|
|
|
|
| 3 |
import os
|
|
|
|
| 4 |
|
| 5 |
-
#
|
| 6 |
client = InferenceClient(
|
| 7 |
-
"HuggingFaceH4/zephyr-7b-beta",
|
| 8 |
-
token=
|
| 9 |
)
|
| 10 |
|
| 11 |
def responder_chat(mensaje, system_message, max_tokens, temperature, top_p):
|
|
@@ -30,12 +33,8 @@ with gr.Blocks() as demo:
|
|
| 30 |
top_p = gr.Slider(minimum=0.1, maximum=1.0, value=0.9, step=0.05, label="Top-p")
|
| 31 |
chat_output = gr.Textbox(label="Respuesta del asistente")
|
| 32 |
|
| 33 |
-
|
| 34 |
-
chat_input.submit(
|
| 35 |
-
responder_chat,
|
| 36 |
-
inputs=[chat_input, system_message, max_tokens, temperature, top_p],
|
| 37 |
-
outputs=chat_output
|
| 38 |
-
)
|
| 39 |
|
| 40 |
demo.launch()
|
| 41 |
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from huggingface_hub import InferenceClient
|
| 3 |
+
|
| 4 |
+
# Reemplaza ESTE TEXTO con tu verdadero token secreto
|
| 5 |
import os
|
| 6 |
+
API_TOKEN = os.getenv("HF_TOKEN")
|
| 7 |
|
| 8 |
+
# Inicializa el cliente con el modelo y el token
|
| 9 |
client = InferenceClient(
|
| 10 |
+
model="HuggingFaceH4/zephyr-7b-beta",
|
| 11 |
+
token=API_TOKEN
|
| 12 |
)
|
| 13 |
|
| 14 |
def responder_chat(mensaje, system_message, max_tokens, temperature, top_p):
|
|
|
|
| 33 |
top_p = gr.Slider(minimum=0.1, maximum=1.0, value=0.9, step=0.05, label="Top-p")
|
| 34 |
chat_output = gr.Textbox(label="Respuesta del asistente")
|
| 35 |
|
| 36 |
+
chat_input.submit(responder_chat, inputs=[chat_input, system_message, max_tokens, temperature, top_p], outputs=chat_output)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
demo.launch()
|
| 39 |
|
| 40 |
+
|