Spaces:
Paused
Paused
"""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/generation_model_2") | |
def generate(text): | |
predictions = pipe(text) | |
print(predictions) # To see the structure of predictions | |
return {p["generated_text"] for p in predictions} | |
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() |