Spaces:
Sleeping
Sleeping
import gradio as gr | |
from transformers import pipeline | |
# Replace 'your_openai_api_key' with your actual OpenAI API key | |
api_key = "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" | |
def generate_response(text): | |
generator = pipeline("text-generation", model="EleutherAI/gpt-neo-2.7B", device=0) # You can choose a different model here | |
response = generator(text, max_length=150, num_return_sequences=1, api_key=api_key) | |
return response[0]['generated_text'] | |
iface = gr.Interface( | |
fn=generate_response, | |
inputs="text", | |
outputs="text", | |
title="GPT-3.5 Turbo Chat", | |
description="An interface to chat with GPT-3.5 Turbo.", | |
live=True, | |
theme="huggingface", | |
) | |
iface.launch() | |