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

def generate_text(prompt, temperature):
    generator = pipeline('text-generation', model='titleos/Seahorse-350m')
    return generator(prompt, max_length=100, temperature=temperature)[0]['generated_text']

interface = gr.Interface(
    fn=generate_text,
    inputs=[
        gr.inputs.Textbox(lines=1, label="Instruction", default="### Instruction What are the three primary colors? ### Response"),
        gr.inputs.Slider(minimum=0.1, maximum=1.0, step=0.1, default=0.5, label="Temperature")
    ],
    outputs=gr.outputs.Textbox(label="Response")
)

interface.launch()