Spaces:
Runtime error
Runtime error
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() |