Spaces:
Sleeping
Sleeping
File size: 754 Bytes
cbfae43 7dfd5db 9c9d121 32cf640 7dfd5db 2144fdb 3b930a2 771a832 2144fdb f37ed6f e62c0db 4f80c95 3b930a2 9c9d121 7dfd5db 7f1d1fc 7dfd5db cbfae43 7dfd5db |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
import frontmatter
import gradio as gr
import spaces
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline
model_id = "AverageBusinessUser/aidapal"
filename = "aidapal-8k.Q4_K_M.gguf"
print("Downloading model")
tokenizer = AutoTokenizer.from_pretrained(model_id, gguf_file=filename)
model = AutoModelForCausalLM.from_pretrained(
model_id,
gguf_file=filename,
device_map="auto"
)
# Then create the pipeline with the model and tokenizer
pipe = pipeline(task="text-generation", model=model, tokenizer=tokenizer)
@spaces.GPU
def greet(name):
return pipe(name)
demo = gr.Interface(fn=greet, inputs="text", outputs="text",
description=frontmatter.load("README.md").content)
demo.launch() |