Spaces:
No application file
No application file
Commit
·
5504e73
1
Parent(s):
64ead53
- app2.py +1 -0
- app3.py +22 -0
- requirements.txt +3 -1
app2.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
from transformers import pipeline
|
| 2 |
import gradio as gr
|
| 3 |
|
|
|
|
| 4 |
|
| 5 |
generator = pipeline(
|
| 6 |
"text2text-generation",
|
|
|
|
| 1 |
from transformers import pipeline
|
| 2 |
import gradio as gr
|
| 3 |
|
| 4 |
+
#Recomendador trabajar o estudiar transformer
|
| 5 |
|
| 6 |
generator = pipeline(
|
| 7 |
"text2text-generation",
|
app3.py
CHANGED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from diffusers import StableDiffusionUpscalePipeline
|
| 2 |
+
import torch
|
| 3 |
+
from PIL import Image
|
| 4 |
+
|
| 5 |
+
# Cargar el pipeline
|
| 6 |
+
model_id = "stabilityai/stable-diffusion-x4-upscaler"
|
| 7 |
+
pipe = StableDiffusionUpscalePipeline.from_pretrained(model_id, torch_dtype=torch.float16)
|
| 8 |
+
pipe = pipe.to("cuda") # usa "cpu" si no tenés GPU
|
| 9 |
+
|
| 10 |
+
# Cargar la imagen a mejorar
|
| 11 |
+
input_image = Image.open("mi_imagen.jpg").convert("RGB")
|
| 12 |
+
|
| 13 |
+
# Prompt opcional: describe cómo quieres mejorar la imagen
|
| 14 |
+
prompt = "A high quality, detailed, and visually clear image"
|
| 15 |
+
|
| 16 |
+
# Ejecutar upscaling
|
| 17 |
+
upscaled_image = pipe(prompt=prompt, image=input_image, scale=4).images[0]
|
| 18 |
+
|
| 19 |
+
# Guardar resultado
|
| 20 |
+
upscaled_image.save("mi_imagen_upscaled.png")
|
| 21 |
+
|
| 22 |
+
print("Imagen upscalada guardada como mi_imagen_upscaled.png")
|
requirements.txt
CHANGED
|
@@ -1,3 +1,5 @@
|
|
| 1 |
gradio
|
| 2 |
transformers==4.49.0
|
| 3 |
-
torch==2.6.0
|
|
|
|
|
|
|
|
|
| 1 |
gradio
|
| 2 |
transformers==4.49.0
|
| 3 |
+
torch==2.6.0
|
| 4 |
+
diffusers
|
| 5 |
+
Pillow
|