Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,19 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
# gr.Interface.load("models/microsoft/git-base").launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from transformers import pipeline
|
| 3 |
|
| 4 |
+
captioner = pipeline(model="microsoft/git-base")
|
| 5 |
+
|
| 6 |
+
def predict(image):
|
| 7 |
+
return captioner(image)[0]["generated_text"]
|
| 8 |
+
|
| 9 |
+
demo = gr.Interface(
|
| 10 |
+
fn=predict,
|
| 11 |
+
inputs=gr.Image,
|
| 12 |
+
outputs='text'
|
| 13 |
+
)
|
| 14 |
+
|
| 15 |
+
demo.launch()
|
| 16 |
+
|
| 17 |
+
# gr.Interface.load("models/ronniet/git-base-env").launch()
|
| 18 |
|
| 19 |
# gr.Interface.load("models/microsoft/git-base").launch()
|