OzoneAsai commited on
Commit
2d45144
·
1 Parent(s): 7e0a1c2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -4
app.py CHANGED
@@ -23,7 +23,19 @@ def generate(prefix_text):
23
  return tokenizer.decode(gen_token[0])
24
 
25
 
26
- # テキストエリアと送信ボタンを追加
27
- with gr.Interface(generate) as demo:
28
- demo.textbox("テキストを入力してください", label="入力")
29
- demo.button("送信", label="送信")
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  return tokenizer.decode(gen_token[0])
24
 
25
 
26
+ def main():
27
+ # テキストエリアを追加
28
+ text_input = gr.Textbox()
29
+
30
+ # 送信ボタンを追加
31
+ submit_button = gr.Button("送信")
32
+
33
+ # テキストエリアと送信ボタンを連携
34
+ submit_button.on_click(lambda: gr.show(generate(text_input.value), title="テキスト生成"))
35
+
36
+ # アプリを起動
37
+ gr.Interface(main).launch()
38
+
39
+
40
+ if __name__ == "__main__":
41
+ main()