Update app.py
Browse files
app.py
CHANGED
|
@@ -1,18 +1,9 @@
|
|
| 1 |
-
import
|
| 2 |
-
|
| 3 |
-
import torch
|
| 4 |
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
# Create Gradio interface
|
| 13 |
-
gr.Interface(
|
| 14 |
-
fn=generate_image,
|
| 15 |
-
inputs=gr.Textbox(label="Enter your prompt"),
|
| 16 |
-
outputs="image",
|
| 17 |
-
title="Hugging Face Image Generator"
|
| 18 |
-
).launch()
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import subprocess
|
|
|
|
| 3 |
|
| 4 |
+
if __name__ == "__main__":
|
| 5 |
+
try:
|
| 6 |
+
# Run the Flask app using Gunicorn with 4 worker processes
|
| 7 |
+
subprocess.run(["gunicorn", "-w", "4", "-b", "0.0.0.0:7860", "myapp:myapp"], check=True)
|
| 8 |
+
except subprocess.CalledProcessError as e:
|
| 9 |
+
print(f"An error occurred while running the application: {e}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|