Spaces:
Runtime error
Runtime error
import gradio as gr | |
from transformers import AutoModelForCausalLM | |
# Load the SquanchNastyAI model from Hugging Face Spaces | |
model = AutoModelForCausalLM.from_pretrained("or4cl3ai/SquanchNastyAI") | |
# Define a function to generate a text response to a prompt | |
def generate_response(prompt): | |
inputs = model.prepare_inputs_for_generation(prompt, max_length=1024) | |
outputs = model.generate(**inputs) | |
return outputs[0] | |
# Create a Gradio interface for the SquanchNastyAI model | |
interface = gr.Interface(fn=generate_response, inputs="text", outputs="text") | |
# Launch the Gradio interface | |
interface.launch() | |