Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -42,16 +42,17 @@ def process_image_and_text(image, text):
|
|
| 42 |
# Only get generated tokens; decode them to text
|
| 43 |
generated_tokens = output[0, inputs['input_ids'].size(1):]
|
| 44 |
generated_text = processor.tokenizer.decode(generated_tokens, skip_special_tokens=True)
|
| 45 |
-
pretty_text = pprint.pp(generated_text)
|
| 46 |
|
| 47 |
-
return
|
| 48 |
|
| 49 |
def chatbot(image, text, history):
|
| 50 |
if image is None:
|
| 51 |
return history + [("Please upload an image first.", None)]
|
| 52 |
|
| 53 |
response = process_image_and_text(image, text)
|
| 54 |
-
|
|
|
|
|
|
|
| 55 |
return history
|
| 56 |
|
| 57 |
# Define the Gradio interface
|
|
|
|
| 42 |
# Only get generated tokens; decode them to text
|
| 43 |
generated_tokens = output[0, inputs['input_ids'].size(1):]
|
| 44 |
generated_text = processor.tokenizer.decode(generated_tokens, skip_special_tokens=True)
|
|
|
|
| 45 |
|
| 46 |
+
return generated_text
|
| 47 |
|
| 48 |
def chatbot(image, text, history):
|
| 49 |
if image is None:
|
| 50 |
return history + [("Please upload an image first.", None)]
|
| 51 |
|
| 52 |
response = process_image_and_text(image, text)
|
| 53 |
+
pretty_response = pprint.pp(response)
|
| 54 |
+
|
| 55 |
+
history.append((text, pretty_response))
|
| 56 |
return history
|
| 57 |
|
| 58 |
# Define the Gradio interface
|