mirror of
https://github.com/gradio-app/gradio.git
synced 2025-02-05 11:10:03 +08:00
* placeholder * changelog * added to readme * client * implement futures * utils * scripts * lint * reorg * scripts * serialization * cleanup * fns * serialize * cache * callbacks * updates * formatting * packaging * requirements * remove changelog * client * access token * formatting * deprecate * format backend * client replace * updates * moving from utils * remove code duplication * rm duplicates * simplify * galleryserializer * serializable * load serializers * fixing errors * errors * typing * tests * changelog * lint * fix lint * fixing files * formatting * type * fix type checking * changelog * changelog * Update client/python/gradio_client/client.py Co-authored-by: Lucain <lucainp@gmail.com> * formatting, tests * formatting, tests * gr.load * refactoring * refactoring' * formatting * formatting * tests * tests * fix tests * cleanup * added tests * adding scripts * formatting * address review comments * readme * serialize info * remove from changelog * version 0.0.2 released * lint * type fix * check * type issues * hf_token * update hf token * telemetry * docs, circle dependency * hf token * formatting * updates * sort * script * external * docs * formatting * fixes * scripts * requirements * fix tests * context * changes * formatting * fixes * format fix --------- Co-authored-by: Lucain <lucainp@gmail.com>
16 lines
438 B
Python
16 lines
438 B
Python
import gradio as gr
|
|
|
|
api = gr.load("huggingface/EleutherAI/gpt-j-6B")
|
|
|
|
def complete_with_gpt(text):
|
|
# Use the last 50 characters of the text as context
|
|
return text[:-50] + api(text[-50:])
|
|
|
|
with gr.Blocks() as demo:
|
|
textbox = gr.Textbox(placeholder="Type here and press enter...", lines=4)
|
|
btn = gr.Button("Generate")
|
|
|
|
btn.click(complete_with_gpt, textbox, textbox)
|
|
|
|
if __name__ == "__main__":
|
|
demo.launch() |