Kosuke-Yamada commited on
Commit
28daccd
β€’
1 Parent(s): e53cba0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -9
app.py CHANGED
@@ -1,20 +1,24 @@
1
  from transformers import pipeline
2
  import gradio as gr
 
3
 
4
- model_repository_name = "Kosuke-Yamada/t5_ad_generation"
5
- ad_pipeline = pipeline("text2text-generation", model_repository_name, no_repeat_ngram_size=1)
 
 
6
 
7
  def main(text):
8
  return ad_pipeline(text)[0]["generated_text"]
9
 
10
  with gr.Blocks() as demo:
11
- with gr.Row():
12
- with gr.Column():
13
- gr.Markdown("# εΊƒε‘Šη”Ÿζˆγƒ‡γƒ’")
14
-
15
- input_text = gr.components.Textbox(lines=1, label="γ‚­γƒΌγƒ―γƒΌγƒ‰γ‚’η©Ίη™½εŒΊεˆ‡γ‚Šγ§ε…₯εŠ›γ—γ¦οΌ")
16
- submit_button = gr.Button("Submit")
17
- output_text = gr.components.Textbox(lines=1, label="η”ŸζˆεΊƒε‘Š")
 
18
 
19
  submit_button.click(main, inputs=[input_text], outputs=[output_text])
20
  demo.launch()
 
1
  from transformers import pipeline
2
  import gradio as gr
3
+ import os
4
 
5
+ hf_token = os.getenvs("HF_TOKEN")
6
+
7
+ model_repository_name = "Kosuke-Yamada/t5_ad_generation2"
8
+ ad_pipeline = pipeline("text2text-generation", model_repository_name, token=hf_token, no_repeat_ngram_size=1)
9
 
10
  def main(text):
11
  return ad_pipeline(text)[0]["generated_text"]
12
 
13
  with gr.Blocks() as demo:
14
+ with gr.Column():
15
+ gr.Markdown("# εΊƒε‘Šη”Ÿζˆγƒ‡γƒ’")
16
+ with gr.Row():
17
+ with gr.Column():
18
+ input_text = gr.components.Textbox(lines=1, label="γ‚­γƒΌγƒ―γƒΌγƒ‰γ‚’η©Ίη™½εŒΊεˆ‡γ‚Šγ§ε…₯εŠ›γ—γ¦οΌ")
19
+ submit_button = gr.Button("Submit")
20
+ with gr.Column():
21
+ output_text = gr.components.Textbox(lines=1, label="η”ŸζˆεΊƒε‘Š")
22
 
23
  submit_button.click(main, inputs=[input_text], outputs=[output_text])
24
  demo.launch()