File size: 546 Bytes
f6c2dc2
ee8c45e
f6c2dc2
ee8c45e
 
 
 
f6c2dc2
ee8c45e
 
 
 
 
 
 
f6c2dc2
ee8c45e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import gradio as gr
from transformers import pipeline

def generate_text(prompt):
    model_name = "TheBloke/openchat_3.5-GGUF"
    generator = pipeline('text-generation', model=model_name)
    return generator(prompt, max_length=50)[0]['generated_text']

iface = gr.Interface(
    fn=generate_text,
    inputs=gr.inputs.Textbox(lines=2, placeholder="Enter your prompt here..."),
    outputs="text",
    title="GPT-3.5 Text Generation",
    description="This is a demo for GPT-3.5 text generation model hosted on Hugging Face."
)

iface.launch()