chat_bot / app.py
yokesh-da
Add application file and dependencies
3dde812
raw
history blame contribute delete
540 Bytes
import gradio as gr
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "Qwen/Qwen2.5-Coder-32B"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name)
def generate_response(input_text):
inputs = tokenizer(input_text, return_tensors="pt")
outputs = model.generate(**inputs)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
return response
demo = gr.Interface(fn=generate_response, inputs="text", outputs="text")
demo.launch()