add auth token
Browse files
app.py
CHANGED
@@ -1,8 +1,13 @@
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
|
|
3 |
|
|
|
|
|
4 |
text_generation_model = "cahya/indochat-tiny"
|
5 |
-
text_generation = pipeline("text-generation", text_generation_model)
|
6 |
|
7 |
|
8 |
def get_answer(user_input, decoding_methods, top_k, top_p, temperature, repetition_penalty, penalty_alpha):
|
|
|
1 |
+
import os
|
2 |
+
import torch
|
3 |
import gradio as gr
|
4 |
from transformers import pipeline
|
5 |
+
import os
|
6 |
|
7 |
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
8 |
+
HF_AUTH_TOKEN = os.environ.get("HF_AUTH_TOKEN")
|
9 |
text_generation_model = "cahya/indochat-tiny"
|
10 |
+
text_generation = pipeline("text-generation", text_generation_model, use_auth_token=HF_AUTH_TOKEN, device=device)
|
11 |
|
12 |
|
13 |
def get_answer(user_input, decoding_methods, top_k, top_p, temperature, repetition_penalty, penalty_alpha):
|