Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,12 +1,14 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 3 |
import torch
|
|
|
|
| 4 |
|
| 5 |
# Load the model and tokenizer
|
| 6 |
model_name = "mrcuddle/SD-Prompter"
|
| 7 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 8 |
model = AutoModelForCausalLM.from_pretrained(model_name)
|
| 9 |
|
|
|
|
| 10 |
# Function to generate a response
|
| 11 |
def chat(message, history):
|
| 12 |
# Combine the message and history into a single input
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 3 |
import torch
|
| 4 |
+
import spaces
|
| 5 |
|
| 6 |
# Load the model and tokenizer
|
| 7 |
model_name = "mrcuddle/SD-Prompter"
|
| 8 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 9 |
model = AutoModelForCausalLM.from_pretrained(model_name)
|
| 10 |
|
| 11 |
+
@spaces.GPU
|
| 12 |
# Function to generate a response
|
| 13 |
def chat(message, history):
|
| 14 |
# Combine the message and history into a single input
|