fffiloni commited on
Commit
a97cae4
·
verified ·
1 Parent(s): 9490d0e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -6
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
- client = Client("https://fffiloni-moondream1.hf.space/", hf_token=hf_token)
69
  result = client.predict(
70
- image_in, # filepath in 'image' Image component
71
- "Describe precisely the image in one sentence.", # str in 'Question' Textbox component
72
- #api_name="/answer_question"
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