Spaces:
Runtime error
Runtime error
File size: 827 Bytes
3441cda |
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 |
import gradio as gr
from transformers import AutoModelForCausalLM, AutoTokenizer
# Load your fine-tuned model
model_name = "SupermanRX/moderateTherapistModel" # Replace with your Hugging Face model path
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name)
def chatbot(input_text):
# Process user input and generate response
inputs = tokenizer(input_text, return_tensors="pt")
outputs = model.generate(inputs["input_ids"], max_length=200, pad_token_id=tokenizer.eos_token_id)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
return response
# Create a Gradio interface
interface = gr.Interface(
fn=chatbot,
inputs="text",
outputs="text",
title="Chat with Your Model"
)
# Launch the Gradio app
interface.launch()
|