ad-generation / app.py
Kosuke-Yamada's picture
Update app.py
28daccd verified
raw
history blame
855 Bytes
from transformers import pipeline
import gradio as gr
import os
hf_token = os.getenvs("HF_TOKEN")
model_repository_name = "Kosuke-Yamada/t5_ad_generation2"
ad_pipeline = pipeline("text2text-generation", model_repository_name, token=hf_token, no_repeat_ngram_size=1)
def main(text):
return ad_pipeline(text)[0]["generated_text"]
with gr.Blocks() as demo:
with gr.Column():
gr.Markdown("# εΊƒε‘Šη”Ÿζˆγƒ‡γƒ’")
with gr.Row():
with gr.Column():
input_text = gr.components.Textbox(lines=1, label="γ‚­γƒΌγƒ―γƒΌγƒ‰γ‚’η©Ίη™½εŒΊεˆ‡γ‚Šγ§ε…₯εŠ›γ—γ¦οΌ")
submit_button = gr.Button("Submit")
with gr.Column():
output_text = gr.components.Textbox(lines=1, label="η”ŸζˆεΊƒε‘Š")
submit_button.click(main, inputs=[input_text], outputs=[output_text])
demo.launch()