Zeeshan42's picture
Update app.py
7005575 verified
raw
history blame contribute delete
687 Bytes
# app.py
from transformers import pipeline
import gradio as gr
# Load the pretrained model using the pipeline
pipe = pipeline("text-generation", model="hamaadayubkhan/Psychologist")
# Define a function that will take user input and use the model to generate text
def generate_text(input_text):
response = pipe(input_text, max_length=100, num_return_sequences=1)
return response[0]['generated_text']
# Set up Gradio interface
interface = gr.Interface(
fn=generate_text,
inputs="text",
outputs="text",
title="Psychologist Text Generation",
description="Enter a prompt and the model will generate a continuation of it."
)
# Launch the app
interface.launch()