Update app.py
Browse files1234567891011121314151617181920212223242526272829303132333435363738import gradio as grimport osos.system('python -m spacy download ru_core_news_sm')import spacyfrom spacy import displacynlp = spacy.load("ru_core_news_sm")def text_analysis(text):doc = nlp(text)html = displacy.render(doc, style="dep", page=True)html = (""+ html+ "")pos_count = {"char_count": len(text),"token_count": 0,}pos_tokens = []for token in doc:pos_tokens.extend([(token.text, token.pos_), (" ", None)])return pos_tokens, pos_count, htmldemo = gr.Interface(text_analysis,gr.Textbox(placeholder="Enter sentence here..."),["highlight", "json", "html"],examples=[["Помню я была живая а теперь как ты"],["На моей руке у судьбы нет линии"],],)demo.launch()
app.py+38