Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,17 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
import concurrent.futures
|
3 |
|
4 |
+
# Load the model into RAM
|
5 |
+
model = gr.load("huggingface/John6666/ultimate-realistic-mix-v2-sdxl")
|
6 |
+
|
7 |
+
def interact(input):
|
8 |
+
# Define the function for user interaction
|
9 |
+
response = model(input)
|
10 |
+
return response
|
11 |
+
|
12 |
+
# Use ThreadPoolExecutor to manage the threads
|
13 |
+
with concurrent.futures.ThreadPoolExecutor(max_workers=2) as executor:
|
14 |
+
# Create a Gradio interface with the loaded model
|
15 |
+
interface = gr.Interface(fn=interact, inputs="text", outputs="image")
|
16 |
+
# Handle the interactions with Gradio
|
17 |
+
interface.launch()
|