Spaces:
No application file
No application file
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,10 +3,8 @@ import numpy as np
|
|
| 3 |
from datasets import load_dataset
|
| 4 |
import gradio as gr
|
| 5 |
|
| 6 |
-
|
| 7 |
-
text_dataset = load_dataset("HuggingFaceFW/fineweb", name="sample-10BT", split="train", streaming=True, columns=['text'])
|
| 8 |
-
|
| 9 |
-
def update(text_dataset):
|
| 10 |
bigram_vectorizer = CountVectorizer(ngram_range=(2, 2), analyzer="word")
|
| 11 |
co_occurrences = bigram_vectorizer.fit_transform(doc['text'] for doc in text_dataset)
|
| 12 |
print('Printing sparse matrix:')
|
|
@@ -20,6 +18,6 @@ def update(text_dataset):
|
|
| 20 |
with gr.Blocks() as app:
|
| 21 |
gr.Markdown("Click **Run** to start calculating.")
|
| 22 |
btn = gr.Button("Run")
|
| 23 |
-
btn.click(fn=update
|
| 24 |
|
| 25 |
app.launch()
|
|
|
|
| 3 |
from datasets import load_dataset
|
| 4 |
import gradio as gr
|
| 5 |
|
| 6 |
+
def update():
|
| 7 |
+
text_dataset = load_dataset("HuggingFaceFW/fineweb", name="sample-10BT", split="train", streaming=True, columns=['text'])
|
|
|
|
|
|
|
| 8 |
bigram_vectorizer = CountVectorizer(ngram_range=(2, 2), analyzer="word")
|
| 9 |
co_occurrences = bigram_vectorizer.fit_transform(doc['text'] for doc in text_dataset)
|
| 10 |
print('Printing sparse matrix:')
|
|
|
|
| 18 |
with gr.Blocks() as app:
|
| 19 |
gr.Markdown("Click **Run** to start calculating.")
|
| 20 |
btn = gr.Button("Run")
|
| 21 |
+
btn.click(fn=update)
|
| 22 |
|
| 23 |
app.launch()
|