add spaces
Browse files
app.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
import gradio as gr
|
2 |
import torch
|
3 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
@@ -16,7 +17,8 @@ model = AutoModelForCausalLM.from_pretrained(model_path, torch_dtype=dtype, devi
|
|
16 |
def create_prompt(instruction):
|
17 |
PROMPT = '''Below is an instruction that describes a task.\n\nWrite a response that appropriately completes the request.\n\n### Instruction:\n{instruction}\n\n### Response:'''
|
18 |
return PROMPT.format(instruction=instruction)
|
19 |
-
|
|
|
20 |
def respond(message, history, system_message, max_tokens, temperature, top_p):
|
21 |
prompt = create_prompt(message)
|
22 |
|
|
|
1 |
+
import spaces
|
2 |
import gradio as gr
|
3 |
import torch
|
4 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
|
|
17 |
def create_prompt(instruction):
|
18 |
PROMPT = '''Below is an instruction that describes a task.\n\nWrite a response that appropriately completes the request.\n\n### Instruction:\n{instruction}\n\n### Response:'''
|
19 |
return PROMPT.format(instruction=instruction)
|
20 |
+
|
21 |
+
@spaces.GPU
|
22 |
def respond(message, history, system_message, max_tokens, temperature, top_p):
|
23 |
prompt = create_prompt(message)
|
24 |
|