Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,20 +1,24 @@
|
|
| 1 |
from transformers import pipeline
|
| 2 |
import gradio as gr
|
|
|
|
| 3 |
|
| 4 |
-
|
| 5 |
-
|
|
|
|
|
|
|
| 6 |
|
| 7 |
def main(text):
|
| 8 |
return ad_pipeline(text)[0]["generated_text"]
|
| 9 |
|
| 10 |
with gr.Blocks() as demo:
|
| 11 |
-
with gr.
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
|
|
|
| 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()
|