Spaces:
Sleeping
Sleeping
File size: 687 Bytes
7005575 7a0dc97 7005575 7a0dc97 7005575 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# 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()
|