kawre commited on
Commit
2674c93
·
verified ·
1 Parent(s): 8fd9afa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -1,6 +1,6 @@
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")
@@ -17,8 +17,12 @@ def respond(message, history, system_message, max_tokens, temperature, top_p):
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 ---
 
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")
 
17
  full_prompt = f"{system_message}\nUsuário: {message}"
18
 
19
  # --- Passo 1: Llama 3.1 (conversational) ---
20
+ result_main = client_main.conversational(
21
+ prompt=full_prompt, # string diretamente
22
+ max_new_tokens=max_tokens,
23
+ temperature=temperature,
24
+ top_p=top_p
25
+ )
26
  response_main = result_main.generated_responses[-1] # pega a última resposta
27
 
28
  # --- Passo 2: FLAN-T5 ---