gradio/demo/gpt2_xl_unified/run.py
Freddy Boulton 38b16beb16
Switch gpt-j-6b model for gpt2-xl (#4750)
* Switch model and fix demo

* fix remaining demos

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2023-06-30 16:30:04 -05:00

15 lines
281 B
Python

import gradio as gr
component = gr.Textbox(lines=5, label="Text")
api = gr.load("huggingface/gpt2-xl")
demo = gr.Interface(
fn=lambda x: x[:-50] + api(x[-50:]),
inputs=component,
outputs=component,
title="gpt2-xl",
)
if __name__ == "__main__":
demo.launch()