BeveledCube commited on
Commit
a2422c2
1 Parent(s): 9cca841
Files changed (4) hide show
  1. .gitignore +2 -1
  2. Dockerfile +1 -5
  3. main.py +2 -2
  4. start.sh +5 -0
.gitignore CHANGED
@@ -1,3 +1,4 @@
1
  __pycache__
2
  node_modules
3
- poetry.lock
 
 
1
  __pycache__
2
  node_modules
3
+ poetry.lock
4
+ cache
Dockerfile CHANGED
@@ -4,13 +4,9 @@ WORKDIR /api
4
 
5
  COPY ./ /api/
6
 
7
- RUN pip install --upgrade pip
8
- RUN pip install -r requirements.txt
9
- RUN poetry install --no-root
10
-
11
  RUN mkdir /api/cache
12
  RUN chmod a+rwx /api/cache
13
 
14
  EXPOSE 7860
15
 
16
- CMD ["python", "main.py"]
 
4
 
5
  COPY ./ /api/
6
 
 
 
 
 
7
  RUN mkdir /api/cache
8
  RUN chmod a+rwx /api/cache
9
 
10
  EXPOSE 7860
11
 
12
+ CMD ["bash", "start.sh"]
main.py CHANGED
@@ -20,8 +20,8 @@ text = "a cat sitting on a table"
20
  # Tokenize text and get features
21
  inputs = clip_processor(text, return_tensors="pt", padding=True)
22
 
23
- with torch.no_grad():
24
- image_features = clip_model.get_image_features(**inputs)
25
 
26
  # Generate image from features
27
  generated_image = clip_model.generate_images(image_features)
 
20
  # Tokenize text and get features
21
  inputs = clip_processor(text, return_tensors="pt", padding=True)
22
 
23
+ # Generate image features
24
+ image_features = clip_model.get_image_features(pixel_values=inputs.pixel_values)
25
 
26
  # Generate image from features
27
  generated_image = clip_model.generate_images(image_features)
start.sh ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ pip install --upgrade pip
2
+ pip install -r requirements.txt
3
+ poetry install --no-root
4
+
5
+ python main.py