File size: 1,105 Bytes
c2fd0be
 
 
 
 
 
9da0a8d
c2fd0be
9da0a8d
c2fd0be
 
 
 
5e23c7b
c2fd0be
9da0a8d
c2fd0be
 
5e23c7b
c2fd0be
9da0a8d
c2fd0be
 
9da0a8d
 
c2fd0be
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import gradio as gr
import multiprocessing

# Function to generate numbers
def generate_numbers():
    result = []
    for number in range(100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000):
        result.append(number)
    return "\n".join(map(str, result))  # Return as string for Textbox

# Function to utilize full CPU using multiprocessing
def cpu_intensive_task():
    with multiprocessing.Pool() as pool:
        pool.map(print, range(100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000))  # Distribute print task over available CPU cores

# Gradio Interface
def gradio_interface():
    return generate_numbers()
share = True

# Updated Gradio Interface
demo = gr.Interface(
    fn=gradio_interface,
    inputs=None,    # No inputs required for this example
    outputs=gr.Textbox(),  # Updated output with gr.Textbox()
    live=True
)

if __name__ == "__main__":
    cpu_intensive_task()  # Utilize full CPU
    demo.launch()