zanemotiwala commited on
Commit
e7b7110
1 Parent(s): 33cb580

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -0
app.py CHANGED
@@ -3,10 +3,19 @@ import logging
3
  from transformers import pipeline
4
  import torch
5
  import requests, json
 
 
 
 
 
 
6
 
7
  description = "Image Recognition & Generation"
8
  title = "This app allows users to upload an image, generation a caption of the image, then use that caption to generate a new image. Isn't it fun!"
9
 
 
 
 
10
  #Here we are going to call multiple endpoints!
11
  def get_completion(inputs, parameters=None, ENDPOINT_URL=""):
12
  headers = {
 
3
  from transformers import pipeline
4
  import torch
5
  import requests, json
6
+ import os
7
+ import io
8
+ from IPython.display import Image, display, HTML
9
+ from PIL import Image
10
+ import base64
11
+ from dotenv import load_dotenv, find_dotenv
12
 
13
  description = "Image Recognition & Generation"
14
  title = "This app allows users to upload an image, generation a caption of the image, then use that caption to generate a new image. Isn't it fun!"
15
 
16
+ _ = load_dotenv(find_dotenv()) # read local .env file
17
+ hf_api_key = os.environ['HF_API_KEY']
18
+
19
  #Here we are going to call multiple endpoints!
20
  def get_completion(inputs, parameters=None, ENDPOINT_URL=""):
21
  headers = {