Seyof-2 / HuggingFace.py
Seif-Yasser's picture
Upload HuggingFace.py
be9e49a verified
raw
history blame contribute delete
336 Bytes
import transformers
from transformers import pipeline
import gradio as gr
model = pipeline("text-generation", model="gpt2", tokenizer="gpt2")
def generate_text(input_text):
return model(input_text)[0]['generated_text']
iface = gr.Interface(fn=generate_text, inputs="text", outputs="text")
iface.launch(share=True)