File size: 598 Bytes
182ac61
0d8b303
cdc7092
0d8b303
182ac61
6623f3a
0d8b303
182ac61
 
a191697
a2d90e8
0d8b303
182ac61
6623f3a
182ac61
6623f3a
 
 
 
182ac61
7ed5b3b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#Imporing required libraries
from transformers import pipeline
import gradio as gr

# Defining the pipeline and the model
pipe_flan = pipeline("text-generation", model="gpt2")

# Text generation
def generator(input):
    output = pipe_flan(input, max_length=50, num_return_sequences=1)
    return output[0]["generated_text"]

# Creating the Gradio Interface
demo = gr.Interface(
    fn=generator,
    inputs=gr.inputs.Textbox(lines=5, label="Input Text"),
    outputs=gr.outputs.Textbox(label="Generated Text")
)

# Lauching the Gradio Interface
demo.launch(server_name="0.0.0.0", server_port=7860)