Spaces:
Running
Running
File size: 1,028 Bytes
6249bac 28daccd 6249bac ace8e63 27449a7 28daccd 6249bac 28daccd 6249bac ace8e63 |
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 |
from transformers import pipeline
import gradio as gr
import os
def auth(user_name, password):
if user_name == os.getenv("USER_NAME") and password == os.getenv("PASSWORD"):
return True
else:
return False
hf_token = os.getenv("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(auth=auth) |