Spaces:
Runtime error
Runtime error
File size: 1,214 Bytes
363d551 0e45657 cd152af 6a22981 cd152af 6a22981 9666f6c cd152af |
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 30 31 32 33 34 35 36 37 |
import gradio as gr
model_name = "vijjuk/codegen-350M-mono-python-18k-alpaca"
demo = gr.load(model_name, src="models")
demo.launch()
#import gradio as gr
#from transformers import AutoTokenizer, AutoModelForCausalLM
#base_model = AutoModelForCausalLM.from_pretrained(model_name)
#tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
#tokenizer.pad_token = tokenizer.eos_token
#tokenizer.padding_side = "right"
# def query(instruction, input):
# prompt = f"""### Instruction:
# Use the Task below and the Input given to write the Response, which is a programming code that can solve the Task.
# ### Task:
# {instruction}
# ### Input:
# {input}
# ### Response:
# """
# input_ids = tokenizer(prompt, return_tensors="pt", truncation=True)
# output_base = base_model.generate(input_ids=input_ids, max_new_tokens=500, do_sample=True, top_p=0.9,temperature=0.5)
# response = "{tokenizer.batch_decode(output_base.detach().cpu().numpy(), skip_special_tokens=True)[0][len(prompt):]}"
# return response
#inputs = ["text", "text"]
#outputs = "text"
#iface = gr.Interface(fn=query, inputs=inputs, outputs=outputs)
#iface.launch() |