Spaces:
Runtime error
Runtime error
Commit
·
126826c
1
Parent(s):
2ea5432
initial commit with gradio
Browse files- .gitignore +62 -0
- app.py +17 -0
- requirements.txt +3 -0
.gitignore
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
public
|
| 2 |
+
*.env
|
| 3 |
+
|
| 4 |
+
.idea/
|
| 5 |
+
|
| 6 |
+
# Created by https://www.gitignore.io/api/hugo,linux,macos
|
| 7 |
+
# Edit at https://www.gitignore.io/?templates=hugo,linux,macos
|
| 8 |
+
|
| 9 |
+
### Hugo ###
|
| 10 |
+
# Generated files by hugo
|
| 11 |
+
/public/
|
| 12 |
+
/resources/_gen/
|
| 13 |
+
|
| 14 |
+
# Executable may be added to repository
|
| 15 |
+
hugo.exe
|
| 16 |
+
hugo.darwin
|
| 17 |
+
hugo.linux
|
| 18 |
+
|
| 19 |
+
### Linux ###
|
| 20 |
+
*~
|
| 21 |
+
|
| 22 |
+
# temporary files which can be created if a process still has a handle open of a deleted file
|
| 23 |
+
.fuse_hidden*
|
| 24 |
+
|
| 25 |
+
# KDE directory preferences
|
| 26 |
+
.directory
|
| 27 |
+
|
| 28 |
+
# Linux trash folder which might appear on any partition or disk
|
| 29 |
+
.Trash-*
|
| 30 |
+
|
| 31 |
+
# .nfs files are created when an open file is removed but is still being accessed
|
| 32 |
+
.nfs*
|
| 33 |
+
|
| 34 |
+
### macOS ###
|
| 35 |
+
# General
|
| 36 |
+
.DS_Store
|
| 37 |
+
.AppleDouble
|
| 38 |
+
.LSOverride
|
| 39 |
+
|
| 40 |
+
# Icon must end with two \r
|
| 41 |
+
Icon
|
| 42 |
+
|
| 43 |
+
# Thumbnails
|
| 44 |
+
._*
|
| 45 |
+
|
| 46 |
+
# Files that might appear in the root of a volume
|
| 47 |
+
.DocumentRevisions-V100
|
| 48 |
+
.fseventsd
|
| 49 |
+
.Spotlight-V100
|
| 50 |
+
.TemporaryItems
|
| 51 |
+
.Trashes
|
| 52 |
+
.VolumeIcon.icns
|
| 53 |
+
.com.apple.timemachine.donotpresent
|
| 54 |
+
|
| 55 |
+
# Directories potentially created on remote AFP share
|
| 56 |
+
.AppleDB
|
| 57 |
+
.AppleDesktop
|
| 58 |
+
Network Trash Folder
|
| 59 |
+
Temporary Items
|
| 60 |
+
.apdisk
|
| 61 |
+
|
| 62 |
+
# End of https://www.gitignore.io/api/hugo,linux,macos
|
app.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
pipe = pipeline("image-to-text",
|
| 5 |
+
model="Salesforce/blip-image-captioning-base")
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
def launch(input):
|
| 9 |
+
out = pipe(input)
|
| 10 |
+
return out[0]['generated_text']
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
iface = gr.Interface(launch,
|
| 14 |
+
inputs=gr.Image(type='pil'),
|
| 15 |
+
outputs="text")
|
| 16 |
+
|
| 17 |
+
iface.launch()
|
requirements.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
transformers
|
| 2 |
+
torch
|
| 3 |
+
gradio
|