Update app.py
Browse files
app.py
CHANGED
@@ -4,24 +4,24 @@ import multiprocessing
|
|
4 |
# Function to generate numbers
|
5 |
def generate_numbers():
|
6 |
result = []
|
7 |
-
for number in range(
|
8 |
result.append(number)
|
9 |
-
return result
|
10 |
|
11 |
# Function to utilize full CPU using multiprocessing
|
12 |
def cpu_intensive_task():
|
13 |
with multiprocessing.Pool() as pool:
|
14 |
-
pool.map(print,
|
15 |
|
16 |
-
#
|
17 |
def gradio_interface():
|
18 |
return generate_numbers()
|
19 |
|
20 |
-
# Gradio Interface
|
21 |
demo = gr.Interface(
|
22 |
fn=gradio_interface,
|
23 |
-
inputs=
|
24 |
-
outputs=gr.
|
25 |
live=True
|
26 |
)
|
27 |
|
|
|
4 |
# Function to generate numbers
|
5 |
def generate_numbers():
|
6 |
result = []
|
7 |
+
for number in range(100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000):
|
8 |
result.append(number)
|
9 |
+
return "\n".join(map(str, result)) # Return as string for Textbox
|
10 |
|
11 |
# Function to utilize full CPU using multiprocessing
|
12 |
def cpu_intensive_task():
|
13 |
with multiprocessing.Pool() as pool:
|
14 |
+
pool.map(print, range(100)) # Distribute print task over available CPU cores
|
15 |
|
16 |
+
# Gradio Interface
|
17 |
def gradio_interface():
|
18 |
return generate_numbers()
|
19 |
|
20 |
+
# Updated Gradio Interface
|
21 |
demo = gr.Interface(
|
22 |
fn=gradio_interface,
|
23 |
+
inputs=None, # No inputs required for this example
|
24 |
+
outputs=gr.Textbox(), # Updated output with gr.Textbox()
|
25 |
live=True
|
26 |
)
|
27 |
|