Update app.py
Browse files
app.py
CHANGED
@@ -2,6 +2,7 @@ from transformers import AutoModelForCausalLM, AutoTokenizer
|
|
2 |
from peft import PeftModel
|
3 |
import torch
|
4 |
import gradio as gr
|
|
|
5 |
|
6 |
# --- Model Loading ---
|
7 |
base_model_id = "unsloth/Meta-Llama-3.1-8B"
|
@@ -22,6 +23,7 @@ except Exception as e:
|
|
22 |
tokenizer = None
|
23 |
|
24 |
# --- Generation Function ---
|
|
|
25 |
def generate_response(information, input_text):
|
26 |
if model is None or tokenizer is None:
|
27 |
return "Model not loaded. Please check the logs."
|
|
|
2 |
from peft import PeftModel
|
3 |
import torch
|
4 |
import gradio as gr
|
5 |
+
from huggingface_hub import spaces
|
6 |
|
7 |
# --- Model Loading ---
|
8 |
base_model_id = "unsloth/Meta-Llama-3.1-8B"
|
|
|
23 |
tokenizer = None
|
24 |
|
25 |
# --- Generation Function ---
|
26 |
+
@spaces.GPU
|
27 |
def generate_response(information, input_text):
|
28 |
if model is None or tokenizer is None:
|
29 |
return "Model not loaded. Please check the logs."
|