AnyaSchen commited on
Commit
9e23387
1 Parent(s): 355f3d8

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +12 -2
README.md CHANGED
@@ -4,8 +4,12 @@ datasets:
4
  language:
5
  - ru
6
  tags:
7
- - poetry
8
- - image
 
 
 
 
9
  ---
10
  This repo contains model for russian poetry generation from images. Poetry can be generated in style of poets: Маяковский, Пушкин, Есенин, Тютчев, Блок.
11
 
@@ -42,6 +46,12 @@ def generate_poetry(fine_tuned_model, image, tokenizer, author):
42
  generated_poetry = generated_poetry.split(f'{author}')[-1]
43
  return generated_poetry
44
 
 
 
 
 
 
 
45
  url = 'https://anandaindia.org/wp-content/uploads/2018/12/happy-man.jpg'
46
  image = Image.open(requests.get(url, stream=True).raw)
47
 
 
4
  language:
5
  - ru
6
  tags:
7
+ - image2poetry
8
+ - Pushkin
9
+ - Tyutchev
10
+ - Mayakovsky
11
+ - Esenin
12
+ - Blok
13
  ---
14
  This repo contains model for russian poetry generation from images. Poetry can be generated in style of poets: Маяковский, Пушкин, Есенин, Тютчев, Блок.
15
 
 
46
  generated_poetry = generated_poetry.split(f'{author}')[-1]
47
  return generated_poetry
48
 
49
+ path = 'AnyaSchen/vit-rugpt3-large-poetry-ft'
50
+ fine_tuned_model = VisionEncoderDecoderModel.from_pretrained(path).to(device)
51
+ feature_extractor = ViTImageProcessor.from_pretrained(path)
52
+ tokenizer = AutoTokenizer.from_pretrained(path)
53
+
54
+
55
  url = 'https://anandaindia.org/wp-content/uploads/2018/12/happy-man.jpg'
56
  image = Image.open(requests.get(url, stream=True).raw)
57