Spaces:
Runtime error
Runtime error
画像の書き出しをしないように調整
Browse files
app.py
CHANGED
@@ -4,6 +4,7 @@ import gradio as gr
|
|
4 |
from PIL import Image
|
5 |
|
6 |
def generate_cloud(text):
|
|
|
7 |
t = Tokenizer()
|
8 |
|
9 |
tokens = t.tokenize(text)
|
@@ -12,14 +13,12 @@ def generate_cloud(text):
|
|
12 |
nouns = [token.base_form for token in tokens if token.part_of_speech.startswith('名詞')]
|
13 |
nouns = (" ").join(nouns)
|
14 |
wc.generate(nouns)
|
15 |
-
wc.
|
16 |
-
image = Image.open("./wordcloud.png")
|
17 |
-
return image
|
18 |
|
19 |
|
20 |
gr.Interface(
|
21 |
fn=generate_cloud,
|
22 |
-
inputs="text",
|
23 |
outputs=gr.Image(type="pil"),
|
24 |
title="WordCloud Demonstration"
|
25 |
).launch()
|
|
|
4 |
from PIL import Image
|
5 |
|
6 |
def generate_cloud(text):
|
7 |
+
|
8 |
t = Tokenizer()
|
9 |
|
10 |
tokens = t.tokenize(text)
|
|
|
13 |
nouns = [token.base_form for token in tokens if token.part_of_speech.startswith('名詞')]
|
14 |
nouns = (" ").join(nouns)
|
15 |
wc.generate(nouns)
|
16 |
+
return wc.to_array()
|
|
|
|
|
17 |
|
18 |
|
19 |
gr.Interface(
|
20 |
fn=generate_cloud,
|
21 |
+
inputs=["text"],
|
22 |
outputs=gr.Image(type="pil"),
|
23 |
title="WordCloud Demonstration"
|
24 |
).launch()
|