Spaces:
Runtime error
Runtime error
File size: 1,850 Bytes
f10968e 6e2fc6f f10968e 23863e2 f10968e 23863e2 f10968e 6e2fc6f 23863e2 6e2fc6f 23863e2 f10968e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
import gradio as gr
from word2vec import get_cosine_similarity, get_cosine_similarity_one_word
def greet(name, name2, name3):
return f"hello {name}!"
with gr.Blocks() as demo:
gr.Markdown("# Welcome to Ancient Greek Word2Vec")
# Tab 1
with gr.Tab("Find nearest neighbours"):
gr.Markdown("## Find nearest neighbours")
# Tab 2
with gr.Tab("Cosine similarity"):
gr.Markdown("## Cosine similarity")
gr.Markdown('### Two different words')
iface = gr.Interface(
fn=get_cosine_similarity,
inputs=[
gr.Textbox(label='Word 1', placeholder='χρηστήριον'),
gr.Textbox(label='Word 2', placeholder='λίκνον'),
gr.Radio(label='Time slice', choices=["archaic_cbow", "classical_cbow", "early_roman_cbow", "hellen_cbow", "late_roman_cbow"])
],
outputs=gr.Textbox(label="Result"),
submit_btn='Calculate'
)
gr.Markdown('### One word in different time slices')
iface = gr.Interface(
fn=get_cosine_similarity_one_word,
inputs=[
gr.Textbox(label='Word', placeholder='χρηστήριον'),
gr.Radio(label='Time slice', choices=["archaic_cbow", "classical_cbow", "early_roman_cbow", "hellen_cbow", "late_roman_cbow"]),
gr.Radio(label='Time slice', choices=["archaic_cbow", "classical_cbow", "early_roman_cbow", "hellen_cbow", "late_roman_cbow"])
],
outputs=gr.Textbox(label="Result"),
submit_btn='Calculate'
)
# Tab 3
with gr.Tab("3D graph"):
gr.Markdown("## 3D graph")
# Tab 4
with gr.Tab("Dictionary"):
gr.Markdown("## Dictionary")
if __name__ == "__main__":
demo.launch() |