Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,16 +1,29 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import subprocess
|
|
|
|
| 3 |
|
| 4 |
-
def
|
| 5 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
subprocess.run(['pip', 'install', 'pygit2==1.15.1'], check=True)
|
| 7 |
subprocess.run(['git', 'clone', 'https://github.com/lllyasviel/Fooocus.git'], check=True)
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
# Crear la interfaz de Gradio
|
| 13 |
-
demo = gr.Interface(fn=
|
| 14 |
|
| 15 |
# Lanzar la aplicaci贸n Gradio
|
| 16 |
demo.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import subprocess
|
| 3 |
+
import os
|
| 4 |
|
| 5 |
+
def setup_fooocus():
|
| 6 |
+
# Directorio de trabajo
|
| 7 |
+
work_dir = '/home/user/app/my_project/Fooocus'
|
| 8 |
+
|
| 9 |
+
# Aseg煤rate de que el directorio de trabajo exista
|
| 10 |
+
os.makedirs(work_dir, exist_ok=True)
|
| 11 |
+
|
| 12 |
+
# Cambia el directorio de trabajo a la ruta deseada
|
| 13 |
+
os.chdir(work_dir)
|
| 14 |
+
|
| 15 |
+
# Comandos para instalar dependencias y clonar el repositorio
|
| 16 |
subprocess.run(['pip', 'install', 'pygit2==1.15.1'], check=True)
|
| 17 |
subprocess.run(['git', 'clone', 'https://github.com/lllyasviel/Fooocus.git'], check=True)
|
| 18 |
+
os.chdir('Fooocus')
|
| 19 |
+
|
| 20 |
+
# Ejecutar el script
|
| 21 |
+
result = subprocess.run(['python', 'entry_with_update.py', '--share', '--always-high-vram'], capture_output=True, text=True)
|
| 22 |
+
|
| 23 |
+
return result.stdout
|
| 24 |
|
| 25 |
# Crear la interfaz de Gradio
|
| 26 |
+
demo = gr.Interface(fn=setup_fooocus, inputs=[], outputs="text")
|
| 27 |
|
| 28 |
# Lanzar la aplicaci贸n Gradio
|
| 29 |
demo.launch()
|