kawre commited on
Commit
8fd9afa
·
verified ·
1 Parent(s): 05fce26

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -9
app.py CHANGED
@@ -1,6 +1,6 @@
1
  import os
2
  import gradio as gr
3
- from huggingface_hub import InferenceClient
4
 
5
  # Pega o token do Hugging Face dos Secrets
6
  HF_TOKEN = os.environ.get("HF_TOKEN")
@@ -16,14 +16,10 @@ def respond(message, history, system_message, max_tokens, temperature, top_p):
16
  # Prompt principal incluindo system_message
17
  full_prompt = f"{system_message}\nUsuário: {message}"
18
 
19
- # --- Passo 1: Llama 3.1 ---
20
- result_main = client_main.text_generation(
21
- prompt=full_prompt,
22
- max_new_tokens=max_tokens,
23
- temperature=temperature,
24
- top_p=top_p
25
- )
26
- response_main = result_main.generated_text
27
 
28
  # --- Passo 2: FLAN-T5 ---
29
  result_aux1 = client_aux1.text_generation(
 
1
  import os
2
  import gradio as gr
3
+ from huggingface_hub import InferenceClient, Conversation
4
 
5
  # Pega o token do Hugging Face dos Secrets
6
  HF_TOKEN = os.environ.get("HF_TOKEN")
 
16
  # Prompt principal incluindo system_message
17
  full_prompt = f"{system_message}\nUsuário: {message}"
18
 
19
+ # --- Passo 1: Llama 3.1 (conversational) ---
20
+ conversation = Conversation(full_prompt)
21
+ result_main = client_main.conversational(conversation)
22
+ response_main = result_main.generated_responses[-1] # pega a última resposta
 
 
 
 
23
 
24
  # --- Passo 2: FLAN-T5 ---
25
  result_aux1 = client_aux1.text_generation(