Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
-
import torch
|
| 3 |
from huggingface_hub import InferenceClient
|
| 4 |
|
| 5 |
-
#
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
def chat_with_model(user_input):
|
| 9 |
# Gửi yêu cầu đến mô hình
|
| 10 |
-
response = client(user_input,
|
| 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
|