Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -17,18 +17,15 @@ model.eval()
|
|
17 |
def predict(prompt, image_url, max_length):
|
18 |
image = processor.image_processor.fetch_images(image_url)
|
19 |
prompts = [[image, prompt]]
|
20 |
-
|
21 |
inputs = processor(prompts[0], return_tensors="pt").to(device)
|
22 |
-
|
23 |
-
generated_ids = model.generate(**inputs, max_length=128)
|
24 |
generated_text = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
|
25 |
-
print(generated_text)
|
26 |
return generated_text
|
27 |
|
28 |
|
29 |
|
30 |
title = "Midjourney-like Image Captioning with IDEFICS"
|
31 |
-
description = "Gradio Demo for generating Midjourney like captions (describe functionality) with IDEFICS"
|
32 |
|
33 |
examples = [
|
34 |
["Describe the following image:", "https://cdn.arstechnica.net/wp-content/uploads/2023/06/zoomout_2-1440x807.jpg", 64],
|
|
|
17 |
def predict(prompt, image_url, max_length):
|
18 |
image = processor.image_processor.fetch_images(image_url)
|
19 |
prompts = [[image, prompt]]
|
|
|
20 |
inputs = processor(prompts[0], return_tensors="pt").to(device)
|
21 |
+
generated_ids = model.generate(**inputs, max_length=max_length)
|
|
|
22 |
generated_text = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
|
|
|
23 |
return generated_text
|
24 |
|
25 |
|
26 |
|
27 |
title = "Midjourney-like Image Captioning with IDEFICS"
|
28 |
+
description = "Gradio Demo for generating *Midjourney* like captions (describe functionality) with **IDEFICS**"
|
29 |
|
30 |
examples = [
|
31 |
["Describe the following image:", "https://cdn.arstechnica.net/wp-content/uploads/2023/06/zoomout_2-1440x807.jpg", 64],
|