gradio/demo/gpt_j_unified/run.py
Abubakar Abid 93e5a82ff2
Interface types: handle input-only, output-only, and unified interfaces (#1108)
* optional labels

* added prop

* Added IOComponent class

* get component fix

* fixed component function

* fixed test components

* formatting

* fixed output tests

* working on blocks tests

* fixed test blocks

* cleanup

* merged

* unrender

* add article

* formatting

* fixed render()

* added demo

* formatting

* merge main

* add interface types

* added output only

* added input only

* formatting

* added demos

* formatting

* removed unnecessary import

* updated demos

* fixed duplication

* fix for state
2022-04-28 03:06:16 -07:00

15 lines
304 B
Python

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