Arrcttacsrks commited on
Commit
a785e67
·
verified ·
1 Parent(s): d09e32b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -1,13 +1,16 @@
 
1
  import gradio as gr
2
- import torch
3
  from huggingface_hub import InferenceClient
4
 
5
- # Khởi tạo client với token
6
- client = InferenceClient(repo_id="Arrcttacsrks/Llama-3.2-3B-Instruct_gguf", token="YOUR_HUGGING_FACE_TOKEN")
 
 
 
7
 
8
  def chat_with_model(user_input):
9
  # Gửi yêu cầu đến mô hình
10
- response = client(user_input, model="Llama-3.2-3B-Instruct-Q8_0.gguf")
11
  return response["generated_text"]
12
 
13
  # Tạo giao diện Gradio
 
1
+ import os
2
  import gradio as gr
 
3
  from huggingface_hub import InferenceClient
4
 
5
+ # Lấy secret key từ biến môi trường
6
+ secret_key = os.getenv("HUGGING_FACE_SECRET_KEY")
7
+
8
+ # Khởi tạo client với secret key
9
+ client = InferenceClient(token=secret_key)
10
 
11
  def chat_with_model(user_input):
12
  # Gửi yêu cầu đến mô hình
13
+ response = client(user_input, model_id="Arrcttacsrks/Llama-3.2-3B-Instruct_gguf", model_name="Llama-3.2-3B-Instruct-Q8_0.gguf")
14
  return response["generated_text"]
15
 
16
  # Tạo giao diện Gradio