Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
from gradio_client import Client
|
| 3 |
import os
|
| 4 |
import json
|
| 5 |
import re
|
|
@@ -65,12 +65,11 @@ def get_caption_from_kosmos(image_in):
|
|
| 65 |
return truncated_caption
|
| 66 |
|
| 67 |
def get_caption(image_in):
|
| 68 |
-
|
| 69 |
result = client.predict(
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
api_name="/predict"
|
| 74 |
)
|
| 75 |
print(result)
|
| 76 |
return result
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from gradio_client import Client, handle_file
|
| 3 |
import os
|
| 4 |
import json
|
| 5 |
import re
|
|
|
|
| 65 |
return truncated_caption
|
| 66 |
|
| 67 |
def get_caption(image_in):
|
| 68 |
+
client = Client("fffiloni/moondream1", hf_token=hf_token)
|
| 69 |
result = client.predict(
|
| 70 |
+
image=handle_file(image_in),
|
| 71 |
+
question="Describe precisely the image in one sentence.",
|
| 72 |
+
api_name="/predict"
|
|
|
|
| 73 |
)
|
| 74 |
print(result)
|
| 75 |
return result
|