Spaces:
Runtime error
Runtime error
Mikhil-jivus
commited on
Commit
•
bbfe136
1
Parent(s):
5af5566
Update app.py
Browse files
app.py
CHANGED
@@ -1,13 +1,19 @@
|
|
1 |
import gradio as gr
|
2 |
import os
|
3 |
from huggingface_hub import InferenceClient
|
|
|
|
|
4 |
|
5 |
"""
|
6 |
For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
|
7 |
"""
|
8 |
|
9 |
access_token = os.getenv('HF_TOKEN')
|
10 |
-
|
|
|
|
|
|
|
|
|
11 |
|
12 |
|
13 |
def respond(
|
|
|
1 |
import gradio as gr
|
2 |
import os
|
3 |
from huggingface_hub import InferenceClient
|
4 |
+
import torch
|
5 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
6 |
|
7 |
"""
|
8 |
For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
|
9 |
"""
|
10 |
|
11 |
access_token = os.getenv('HF_TOKEN')
|
12 |
+
# Load the tokenizer and model from the Hugging Face repository
|
13 |
+
tokenizer = AutoTokenizer.from_pretrained(repo_id, token=access_token)
|
14 |
+
|
15 |
+
|
16 |
+
client = InferenceClient("text-generation",model="Mikhil-jivus/Llama-32-3B-FineTuned",tokenizer=tokenizer,token = access_token)
|
17 |
|
18 |
|
19 |
def respond(
|