Update app.py
Browse files
app.py
CHANGED
|
@@ -7,6 +7,18 @@ from transformers import ViltProcessor, ViltForQuestionAnswering
|
|
| 7 |
import torch
|
| 8 |
import pandas as pd
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
processor = ViltProcessor.from_pretrained("dandelin/vilt-b32-finetuned-vqa")
|
| 11 |
model = ViltForQuestionAnswering.from_pretrained("dandelin/vilt-b32-finetuned-vqa")
|
| 12 |
def answer_question(gallery):
|
|
|
|
| 7 |
import torch
|
| 8 |
import pandas as pd
|
| 9 |
|
| 10 |
+
#funtion to turn list outputed into a dataframe
|
| 11 |
+
def list_to_dataframe(attribute_list):
|
| 12 |
+
# Row indices
|
| 13 |
+
row_indices = ['color', 'style', 'vibe', 'product',
|
| 14 |
+
'personalizable', 'material', 'event', 'font']
|
| 15 |
+
# Split the list into rows of 8 elements each
|
| 16 |
+
rows = [attribute_list[i:i + len(row_indices)] for i in range(0, len(attribute_list), 8)]
|
| 17 |
+
# Create the DataFrame
|
| 18 |
+
df = pd.DataFrame(rows, columns=row_indices)
|
| 19 |
+
|
| 20 |
+
return df
|
| 21 |
+
|
| 22 |
processor = ViltProcessor.from_pretrained("dandelin/vilt-b32-finetuned-vqa")
|
| 23 |
model = ViltForQuestionAnswering.from_pretrained("dandelin/vilt-b32-finetuned-vqa")
|
| 24 |
def answer_question(gallery):
|