Skip to content

Commit

Permalink
fix gradio shibing624#136
Browse files Browse the repository at this point in the history
  • Loading branch information
shibing624 committed Nov 2, 2023
1 parent d64117f commit f37c0da
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions examples/gradio_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"""

import gradio as gr

from text2vec import Similarity, EncoderType

# 中文句向量模型(CoSENT)
Expand All @@ -26,16 +27,13 @@ def ai_text(sentence1, sentence2):
['一个女人在看书。', '一个女人在揉面团'],
['一个男人在车库里举重。', '一个人在举重。'],
]
input1 = gr.inputs.Textbox(lines=2, placeholder="Enter First Sentence")
input2 = gr.inputs.Textbox(lines=2, placeholder="Enter Second Sentence")

output_text = gr.outputs.Textbox()
gr.Interface(ai_text,
inputs=[input1, input2],
outputs=[output_text],
# theme="grass",
title="Chinese Text to Vector Model shibing624/text2vec-base-chinese",
description="Copy or input Chinese text here. Submit and the machine will calculate the cosine score.",
article="Link to <a href='https://github.com/shibing624/text2vec' style='color:blue;' target='_blank\'>Github REPO</a>",
examples=examples
).launch()
gr.Interface(
ai_text,
inputs=['text', 'text'],
outputs='text',
theme="soft",
title="Chinese Text to Vector Model shibing624/text2vec-base-chinese",
description="Copy or input Chinese text here. Submit and the machine will calculate the cosine score.",
article="Link to <a href='https://github.com/shibing624/text2vec' style='color:blue;' target='_blank\'>Github REPO</a>",
examples=examples
).launch()

0 comments on commit f37c0da

Please sign in to comment.