Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,7 +2,7 @@ from PIL import Image
|
|
| 2 |
import gradio as gr
|
| 3 |
from transformers import BlipProcessor, BlipForConditionalGeneration
|
| 4 |
|
| 5 |
-
model_id = "Salesforce/blip-image-captioning-
|
| 6 |
|
| 7 |
model = BlipForConditionalGeneration.from_pretrained(model_id)
|
| 8 |
processor = BlipProcessor.from_pretrained(model_id)
|
|
@@ -17,8 +17,8 @@ def launch(input_file):
|
|
| 17 |
generated_text = processor.decode(out[0], skip_special_tokens=True)
|
| 18 |
|
| 19 |
# Agregar prefijo y sufijo al texto generado
|
| 20 |
-
prefijo = "Texture
|
| 21 |
-
sufijo = " top view, flat"
|
| 22 |
result = f"{prefijo}{generated_text}{sufijo}"
|
| 23 |
|
| 24 |
# Devolver tanto la imagen como el texto
|
|
|
|
| 2 |
import gradio as gr
|
| 3 |
from transformers import BlipProcessor, BlipForConditionalGeneration
|
| 4 |
|
| 5 |
+
model_id = "Salesforce/blip-image-captioning-base"
|
| 6 |
|
| 7 |
model = BlipForConditionalGeneration.from_pretrained(model_id)
|
| 8 |
processor = BlipProcessor.from_pretrained(model_id)
|
|
|
|
| 17 |
generated_text = processor.decode(out[0], skip_special_tokens=True)
|
| 18 |
|
| 19 |
# Agregar prefijo y sufijo al texto generado
|
| 20 |
+
prefijo = "Texture, "
|
| 21 |
+
sufijo = " top view, flat, hq, detailed"
|
| 22 |
result = f"{prefijo}{generated_text}{sufijo}"
|
| 23 |
|
| 24 |
# Devolver tanto la imagen como el texto
|