Spaces:
Paused
Paused
File size: 1,418 Bytes
a4671ce f18eb47 24304e1 675211a 24304e1 f18eb47 b0fdb33 24304e1 f18eb47 a837e17 f18eb47 24304e1 a4671ce c6d4788 a4671ce 6a55023 a4671ce c6d4788 a4671ce c6d4788 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
"""import gradio as gr
from transformers import pipeline
pipeline = pipeline(task="text-generation", model="Preetham04/text-generation")
def predict(input_img):
predictions = pipeline(input_img)
return {p["title"] for p in predictions}
gradio_app = gr.Interface(
predict,
inputs="textbox",
outputs="text",
title="Text-generation",
)
if __name__ == "__main__":
gradio_app.launch(share=True)
"""
"""
import gradio as gr
from transformers import pipeline
pipe = pipeline("text-generation", model="Preetham04/text-generation")
def generate(text):
return pipe(text)[0]["title"]
with gr.Blocks() as demo:
with gr.Row():
with gr.Column():
find = gr.Textbox(label="input text")
search_btn = gr.Button(value="SEARCH")
with gr.Column():
found = gr.Textbox(label="Related searches")
search_btn.click(generate, inputs=find, outputs=found)
examples = gr.Examples(examples=["SDE", "UX"],
inputs=[find])
demo.launch()
"""
import gradio as gr
description = "Story generation with GPT-2"
title = "Generate your own story"
examples = [["Adventurer is approached by a mysterious stranger in the tavern for a new quest."]]
interface = gr.Interface.load("huggingface/pranavpsv/gpt2-genre-story-generator",
description=description,
examples=examples
)
interface.launch() |