Spaces:
Runtime error
Runtime error
File size: 563 Bytes
a29b34c 3e224b1 a29b34c 3e224b1 be42df5 7791851 3e224b1 7791851 3e224b1 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
import gradio as gr
import concurrent.futures
# Load the model into RAM
model = gr.load("huggingface/black-forest-labs/FLUX.1-dev")
def interact(input):
# Define the function for user interaction
response = model(input)
return response
# Use ThreadPoolExecutor to manage the threads
with concurrent.futures.ThreadPoolExecutor(max_workers=2) as executor:
# Create a Gradio interface with the loaded model
interface = gr.Interface(fn=interact, inputs="text", outputs="image")
# Handle the interactions with Gradio
interface.launch() |