Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
| 3 |
import torch
|
| 4 |
|
| 5 |
-
#
|
| 6 |
-
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
# Chatbot function
|
| 10 |
def chatbot_somali(msg):
|
|
|
|
| 1 |
+
import os
|
| 2 |
import gradio as gr
|
| 3 |
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
| 4 |
import torch
|
| 5 |
|
| 6 |
+
# Read Hugging Face Token from environment
|
| 7 |
+
hf_token = os.environ.get("HUGGINGFACE_TOKEN")
|
| 8 |
+
|
| 9 |
+
# Load Somali model (private)
|
| 10 |
+
tokenizer = AutoTokenizer.from_pretrained("cmlang/somali-flan-t5", use_auth_token=hf_token)
|
| 11 |
+
model = AutoModelForSeq2SeqLM.from_pretrained("cmlang/somali-flan-t5", use_auth_token=hf_token)
|
| 12 |
|
| 13 |
# Chatbot function
|
| 14 |
def chatbot_somali(msg):
|