Gradioで出力を2つ同時に出す方法 (2024/2/25)

Gradio簡単にテキストの入力と出力のインターフェースをもつWebサイトを作成できるのですが,2つのモデルを作成して,その出力を同時に出したい場合にどうするかが,ちょっと調べてもでてなかったので記しておきます (gradio.mix Parallel というのがあったかもしれませんが,下記にように普通に書けます).

下記のようなコードになります

import gradio as gr

model1_label = "実装例1."
model2_label = "実装例2."

def greet(name, intensity):
    out1 = "Hello " * intensity + name + "!"
    out2 = "haha " * intensity + name + "!"
    return out1,out2


demo1= gr.Interface(
    fn = greet,
    inputs = [
        gr.Textbox(lines=5, label="入力テキスト"),
        gr.Slider(1, 10, step=1, label="何個事例を入れるか"),
    ],
    outputs = [
        gr.Textbox(label=model1_label), 
        gr.Textbox(label=model2_label)
    ],
    allow_flagging='never',
)

demo1.launch(server_name="0.0.0.0", server_port=7877, share=True)

結局,出力の部分で textを2つ出力させるようにします.表示は下記のようになります.

参考 https://www.gradio.app/guides/quickstart

2023/11/27 Rockly linux 9.3 で dnf installでエラーが出る場合の対処

Rockly linux 9.3でdnf installをする際エラーが出て動かない時がある.例えば perlなど入れたい場合に

dnf install perl-App-cpanminus perl-devel

メタデータの期限切れの最終確認: 0:00:45 前の 2023年11月28日 06時35分25秒 に実施しました。

エラー: 

 問題 1: package perl-devel-4:5.32.1-480.el9.x86_64 from appstream requires redhat-rpm-config, but none of the providers can be installed

  – package redhat-rpm-config-201-1.el9.noarch from appstream requires kernel-srpm-macros >= 1.0-6, but none of the providers can be installed

  – ジョブの最良アップデート候補をインストールできません

  – package kernel-srpm-macros-1.0-13.el9.noarch from appstream is filtered out by exclude filtering

 問題 2: package perl-4:5.32.1-480.el9.x86_64 from appstream requires perl-devel(x86-64) = 4:5.32.1-480.el9, but none of the providers can be installed

  – package perl-devel-4:5.32.1-480.el9.x86_64 from appstream requires redhat-rpm-config, but none of the providers can be installed

  – package perl-App-cpanminus-1.7044-14.el9.noarch from appstream requires perl, but none of the providers can be installed

  – package redhat-rpm-config-201-1.el9.noarch from appstream requires kernel-srpm-macros >= 1.0-6, but none of the providers can be installed

  – 競合するリクエスト

  – package kernel-srpm-macros-1.0-13.el9.noarch from appstream is filtered out by exclude filtering

(インストール不可のパッケージをスキップするには、’–skip-broken’ を追加してみてください または、’–nobest’ を追加して、最適候補のパッケージのみを使用しないでください)

このように filtered されてしまって入らない.これは https://bugzilla.redhat.com/show_bug.cgi?id=1891603ここに参考にあるように

/etc/dnf/dnf.conf をエディターで開いて下記の部分をコメントアウトする

external=kernel* の部分を#でコメントアウト

すると dnf installが成功する

桂辰弥さんが第22回情報科学技術フォーラム(FIT2023)でFIT奨励賞を受賞しました

桂辰弥さんが第22回情報科学技術フォーラム(FIT2023)でFIT奨励賞を受賞しました.

ブラウザ上でユーザが編集可能な言語パターンマッチシステムの構築
桂 辰弥・竹内 孔一(岡山大学)

https://www.ipsj.or.jp/event/fit/fit2023/abstract/data/html/program/e.html

2023/7/10 桂さん(M1)が国際会議IIAI 2023で発表しました

桂さん(M1)が下記の内容で国際会議IIAI2023で発表しました.

Tatsuya Katsura and Koichi Takeuchi, A Platform for Searching Texts for Desired Expressions in a User-Editable Pattern Matching Environment for Language Learning, IIAI 2023

(プログラムhttps://iaiai.org/conference/aai2023/wp-content/uploads/2023/07/program-web-20230707.pdf )

2023/6/30 第151回 情報基礎とアクセス技術研究発表会

第151回 情報基礎とアクセス技術研究発表会 (IFAT)に参加しました

2件の発表があり,言語処理に関連する議論で盛り上がりました.encoder系のBERTだけでなく,近年話題になっている生成系(decoder系)の言語モデルについても議論が交わされて,大変興味深かったです.