Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,19 +1,33 @@
|
|
| 1 |
import os
|
| 2 |
-
|
| 3 |
-
# Print the current working directory
|
| 4 |
-
print("Current working directory:", os.getcwd())
|
| 5 |
|
| 6 |
# Clone the Fooocus repository
|
| 7 |
os.system("git clone https://github.com/lllyasviel/Fooocus.git")
|
| 8 |
|
| 9 |
-
# List files in the current directory
|
| 10 |
-
os.system("ls")
|
| 11 |
-
|
| 12 |
# Change directory to Fooocus
|
| 13 |
os.chdir("Fooocus")
|
| 14 |
|
| 15 |
# Install dependencies
|
| 16 |
os.system("pip install pygit2==1.15.1")
|
| 17 |
|
| 18 |
-
#
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import os
|
| 2 |
+
import gradio as gr
|
|
|
|
|
|
|
| 3 |
|
| 4 |
# Clone the Fooocus repository
|
| 5 |
os.system("git clone https://github.com/lllyasviel/Fooocus.git")
|
| 6 |
|
|
|
|
|
|
|
|
|
|
| 7 |
# Change directory to Fooocus
|
| 8 |
os.chdir("Fooocus")
|
| 9 |
|
| 10 |
# Install dependencies
|
| 11 |
os.system("pip install pygit2==1.15.1")
|
| 12 |
|
| 13 |
+
# Import Fooocus
|
| 14 |
+
from entry_with_update import main
|
| 15 |
+
|
| 16 |
+
# Define a function to run Fooocus
|
| 17 |
+
def run_fooocus(prompt):
|
| 18 |
+
# Call Fooocus with the provided prompt
|
| 19 |
+
# Modify the `main` function in Fooocus to accept a prompt and return an image
|
| 20 |
+
output_image_path = main(prompt)
|
| 21 |
+
return output_image_path
|
| 22 |
+
|
| 23 |
+
# Create a Gradio interface
|
| 24 |
+
iface = gr.Interface(
|
| 25 |
+
fn=run_fooocus, # Function to call
|
| 26 |
+
inputs="text", # Input is a text prompt
|
| 27 |
+
outputs="image", # Output is an image
|
| 28 |
+
title="Fooocus on Hugging Face Spaces",
|
| 29 |
+
description="Generate images using Fooocus."
|
| 30 |
+
)
|
| 31 |
+
|
| 32 |
+
# Launch the Gradio app
|
| 33 |
+
iface.launch()
|