Space_testing / app.py
WICKED4950's picture
Update app.py
07f8c16 verified
raw
history blame
791 Bytes
import gradio as gr
from transformers import AutoModelForCausalLM, AutoTokenizer
# Load your model
print("Loading the model......")
model_name = "WICKED4950/Irisonego5"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name)
print("Interface getting done....")
# Define the chatbot function
def chatbot(input_text):
inputs = tokenizer(input_text, return_tensors="pt")
outputs = model.generate(inputs["input_ids"], max_length=100)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
return response
# Gradio interface
iface = gr.Interface(fn=chatbot,
inputs="text",
outputs="text",
title="Your Chatbot")
print("Deploying")
iface.launch()