Spaces:
Runtime error
Runtime error
File size: 878 Bytes
3722f7b 3e899a5 3722f7b 7870440 fd100ba 3722f7b 9573490 3722f7b 46634ed ccd0d6e 46634ed 3722f7b 46634ed fd100ba |
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 |
import gradio as gr
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = 'deepseek-ai/DeepSeek-V3'
gr.load('models/' + model_name).launch()
'''
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name,trust_remote_code=True)
def call_llm(input_text):
input_ids = tokenizer.encode(input_text, return_tensors="pt")
kwargs = {
"max_length": 500,
"num_return_sequences": 1,
"temperature": 0.7,
"top_k": 50,
}
# Generate text
output_ids = model.generate(input_ids, **kwargs)
# Decode and print the output
output_text = tokenizer.decode(output_ids[0], skip_special_tokens=True)
print(output_text)
return output_text
with gr.Blocks() as app:
chat = gr.ChatInterface(
call_llm,
)
app.launch()
''' |