Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import torch
|
| 3 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
|
@@ -17,6 +19,7 @@ def load_models():
|
|
| 17 |
|
| 18 |
model, tokenizer = load_models()
|
| 19 |
|
|
|
|
| 20 |
def generate_enhanced_caption(image_caption, text_caption):
|
| 21 |
"""Generate enhanced caption using the LeX-Enhancer model"""
|
| 22 |
combined_caption = f"{image_caption}, with the text on it: {text_caption}."
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import spaces
|
| 3 |
import gradio as gr
|
| 4 |
import torch
|
| 5 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
|
|
|
| 19 |
|
| 20 |
model, tokenizer = load_models()
|
| 21 |
|
| 22 |
+
@spaces.GPU(duration=70)
|
| 23 |
def generate_enhanced_caption(image_caption, text_caption):
|
| 24 |
"""Generate enhanced caption using the LeX-Enhancer model"""
|
| 25 |
combined_caption = f"{image_caption}, with the text on it: {text_caption}."
|