Agric-bot / app.py
Mataa's picture
Update app.py
3e6c9c5 verified
raw
history blame contribute delete
541 Bytes
import gradio as gr
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "groq/Llama-3-Groq-70B-Tool-Use"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name)
def generate_response(prompt):
inputs = tokenizer(prompt, return_tensors="pt")
outputs = model.generate(**inputs)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
return response
iface = gr.Interface(fn=generate_response, inputs="text", outputs="text")
iface.launch()