Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline
|
| 3 |
|
| 4 |
# Use the base (untrained) model from Hugging Face Hub
|
| 5 |
model_id = "mistralai/Mistral-7B-Instruct-v0.3"
|
| 6 |
-
# Your Hugging Face token
|
| 7 |
|
| 8 |
-
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 9 |
-
model = AutoModelForCausalLM.from_pretrained(model_id)
|
| 10 |
|
| 11 |
pipe = pipeline(
|
| 12 |
"text-generation",
|
|
|
|
| 1 |
+
import os
|
| 2 |
import gradio as gr
|
| 3 |
from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline
|
| 4 |
|
| 5 |
# Use the base (untrained) model from Hugging Face Hub
|
| 6 |
model_id = "mistralai/Mistral-7B-Instruct-v0.3"
|
| 7 |
+
api_key = os.environ.get("API_TOKEN") # Your Hugging Face token
|
| 8 |
|
| 9 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id, token = api_key)
|
| 10 |
+
model = AutoModelForCausalLM.from_pretrained(model_id, token = api_key)
|
| 11 |
|
| 12 |
pipe = pipeline(
|
| 13 |
"text-generation",
|