commit f6f2fe1d5e198193acf8e7e73ed20156dfc62b20
Author: SOULOFCINDER <841135647@qq.com>
Date: Wed Mar 29 16:59:06 2023 +0800
initial
diff --git a/git_large_coco/Masahiro.png b/git_large_coco/Masahiro.png
new file mode 100644
index 0000000..1a43102
Binary files /dev/null and b/git_large_coco/Masahiro.png differ
diff --git a/git_large_coco/app.py b/git_large_coco/app.py
new file mode 100644
index 0000000..81446f7
--- /dev/null
+++ b/git_large_coco/app.py
@@ -0,0 +1,61 @@
+import gradio as gr
+from PIL import Image
+from transformers import AutoProcessor, AutoModelForCausalLM, AutoConfig
+
+
+def inference(img):
+ pretrained_model_path = "git-large-coco"
+
+ processor = AutoProcessor.from_pretrained(pretrained_model_path)
+ model = AutoModelForCausalLM.from_pretrained(pretrained_model_path)
+
+ pixel_values = processor(images=img, return_tensors="pt").pixel_values
+
+ generated_ids = model.generate(pixel_values=pixel_values, max_length=50)
+ generated_caption = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
+ return generated_caption
+
+title = "git-large-coco"
+description = "Gradio Demo for git-large-coco. To use it, simply upload your image, or click one of the examples to load them."
+article = "
Github Repo Pytorch
"
+examples=[['example_cat.jpg'],['Masahiro.png']]
+
+demo = gr.Interface(
+ fn=inference,
+ inputs=[gr.inputs.Image(type="pil")],
+ outputs=gr.outputs.Textbox(),
+ title=title,
+ description=description,
+ article=article,
+ examples=examples)
+
+demo.launch()
+
+
+##
+
+
+# model_dir = "hub/animegan2-pytorch-main"
+# model_dir_weight = "hub/checkpoints/face_paint_512_v1.pt"
+#
+# model2 = torch.hub.load(
+# model_dir,
+# "generator",
+# pretrained=True,
+# progress=False,
+# source="local"
+# )
+# model1 = torch.load(model_dir_weight)
+# face2paint = torch.hub.load(
+# model_dir, 'face2paint',
+# size=512,side_by_side=False,
+# source="local"
+# )
+#
+# def inference(img, ver):
+# if ver == 'version 2 (🔺 robustness,🔻 stylization)':
+# out = face2paint(model2, img)
+# else:
+# out = face2paint(model1, img)
+# return out
+#
diff --git a/git_large_coco/example_cat.jpg b/git_large_coco/example_cat.jpg
new file mode 100644
index 0000000..e131e8e
Binary files /dev/null and b/git_large_coco/example_cat.jpg differ
diff --git a/git_large_coco/flagged/img/tmp7_1jxsu7.png b/git_large_coco/flagged/img/tmp7_1jxsu7.png
new file mode 100644
index 0000000..1a43102
Binary files /dev/null and b/git_large_coco/flagged/img/tmp7_1jxsu7.png differ
diff --git a/git_large_coco/flagged/log.csv b/git_large_coco/flagged/log.csv
new file mode 100644
index 0000000..d8d4067
--- /dev/null
+++ b/git_large_coco/flagged/log.csv
@@ -0,0 +1,2 @@
+img,output,flag,username,timestamp
+D:\workspace\py\image_to_text\git_large_coco\flagged\img\tmp7_1jxsu7.png,a man in a blue shirt and a white shirt sits at a table.,,,2023-03-29 16:56:46.342770
diff --git a/git_large_coco/git-large-coco b/git_large_coco/git-large-coco
new file mode 160000
index 0000000..46c328c
--- /dev/null
+++ b/git_large_coco/git-large-coco
@@ -0,0 +1 @@
+Subproject commit 46c328cb5d807d198b593eb2f692179cd896b0b9