Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -27,15 +27,15 @@ feature_extractor = ViTFeatureExtractor.from_pretrained(repo_name)
|
|
| 27 |
tokenizer = AutoTokenizer.from_pretrained(repo_name)
|
| 28 |
model = VisionEncoderDecoderModel.from_pretrained(repo_name)
|
| 29 |
|
| 30 |
-
def get_quote(
|
| 31 |
|
| 32 |
-
image = Image.open(image_1).raw
|
| 33 |
#image = Image.open(image_1)
|
| 34 |
|
| 35 |
#url = "http://images.cocodataset.org/val2017/000000039769.jpg"
|
| 36 |
#with Image.open(requests.get(url, stream=True).raw) as image:
|
| 37 |
|
| 38 |
-
image.save("cats.png")
|
| 39 |
|
| 40 |
|
| 41 |
##############
|
|
@@ -56,8 +56,9 @@ def get_quote(image_1):
|
|
| 56 |
#import gradio as gr
|
| 57 |
title = "Image to text generation"
|
| 58 |
|
| 59 |
-
demo = gr.Interface(fn=get_quote,
|
| 60 |
#inputs = "image"
|
|
|
|
| 61 |
if __name__ == "__main__":
|
| 62 |
|
| 63 |
demo.launch(debug=True, cache_examples=True)
|
|
|
|
| 27 |
tokenizer = AutoTokenizer.from_pretrained(repo_name)
|
| 28 |
model = VisionEncoderDecoderModel.from_pretrained(repo_name)
|
| 29 |
|
| 30 |
+
def get_quote(image):
|
| 31 |
|
| 32 |
+
#image = Image.open(image_1).raw
|
| 33 |
#image = Image.open(image_1)
|
| 34 |
|
| 35 |
#url = "http://images.cocodataset.org/val2017/000000039769.jpg"
|
| 36 |
#with Image.open(requests.get(url, stream=True).raw) as image:
|
| 37 |
|
| 38 |
+
#image.save("cats.png")
|
| 39 |
|
| 40 |
|
| 41 |
##############
|
|
|
|
| 56 |
#import gradio as gr
|
| 57 |
title = "Image to text generation"
|
| 58 |
|
| 59 |
+
demo = gr.Interface(fn=get_quote, gr.Image(type="pil"), "image", outputs=['text'],title = title, description = "Import an image file and get text from it" ,cache_examples=False, enable_queue=True).launch()
|
| 60 |
#inputs = "image"
|
| 61 |
+
#inputs=gr.inputs.Image(type="pil")
|
| 62 |
if __name__ == "__main__":
|
| 63 |
|
| 64 |
demo.launch(debug=True, cache_examples=True)
|