trcprogrammer commited on
Commit
d620052
verified
1 Parent(s): 5a1cc05

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -30
app.py CHANGED
@@ -1,36 +1,16 @@
1
- import os
2
- import subprocess
3
  import gradio as gr
 
4
 
5
- # Crear una carpeta para el proyecto
6
- project_dir = "my_project"
7
- if not os.path.exists(project_dir):
8
- os.makedirs(project_dir)
9
-
10
- # Cambiar al directorio del proyecto
11
- os.chdir(project_dir)
12
-
13
- # Crear y activar un entorno virtual (esto es para asegurarte de que los paquetes se instalen correctamente)
14
- subprocess.run(["python3", "-m", "venv", "venv"])
15
- subprocess.run(["source", "venv/bin/activate"], shell=True)
16
-
17
- # Instalar dependencias
18
- subprocess.run(["pip", "install", "--upgrade", "pip", "setuptools", "wheel"])
19
- subprocess.run(["pip", "install", "pygit2==1.15.1", "packaging", "gitpython", "requests", "numpy", "pandas"])
20
-
21
- # Clonar el repositorio desde GitHub
22
- if not os.path.exists("Fooocus"):
23
- subprocess.run(["git", "clone", "https://github.com/lllyasviel/Fooocus.git"])
24
-
25
- # Cambiar al directorio del repositorio clonado
26
- os.chdir("Fooocus")
27
 
28
- # Ejecutar el script Python
29
- subprocess.run(["python", "entry_with_update.py", "--share", "--always-high-vram"])
30
 
31
- # Definir la aplicaci贸n Gradio
32
- def greet(name):
33
- return f"Hello {name}!!"
34
 
35
- demo = gr.Interface(fn=greet, inputs="text", outputs="text")
36
  demo.launch()
 
 
 
1
  import gradio as gr
2
+ import subprocess
3
 
4
+ def run_fooocus():
5
+ # Ejecutar comandos de instalaci贸n y configuraci贸n
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
+ subprocess.run(['python', 'Fooocus/entry_with_update.py', '--share', '--always-high-vram'], check=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
 
10
+ return "Fooocus est谩 en ejecuci贸n."
 
11
 
12
+ # Crear la interfaz de Gradio
13
+ demo = gr.Interface(fn=run_fooocus, inputs=[], outputs="text")
 
14
 
15
+ # Lanzar la aplicaci贸n Gradio
16
  demo.launch()