fffiloni commited on
Commit
6d91801
·
verified ·
1 Parent(s): 9f6e8f7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -1,10 +1,12 @@
1
  import gradio as gr
2
  from gradio_client import Client
3
-
4
  from PIL import Image
5
  import io
6
  import base64
7
 
 
 
8
  def convert_base64_to_img(image_string):
9
  # Split the input string to separate the metadata header and the base64-encoded data
10
  header, encoded_data = image_string.split(",", 1)
@@ -25,7 +27,7 @@ def convert_base64_to_img(image_string):
25
 
26
  def infer(image_string, question):
27
  image_in = convert_base64_to_img(image_string)
28
- client = Client("https://fffiloni-moondream1.hf.space/")
29
  result = client.predict(
30
  image_in, # filepath in 'image' Image component
31
  question, # str in 'Question' Textbox component
 
1
  import gradio as gr
2
  from gradio_client import Client
3
+ import os
4
  from PIL import Image
5
  import io
6
  import base64
7
 
8
+ hf_token = os.environ.get("KF_TKN")
9
+
10
  def convert_base64_to_img(image_string):
11
  # Split the input string to separate the metadata header and the base64-encoded data
12
  header, encoded_data = image_string.split(",", 1)
 
27
 
28
  def infer(image_string, question):
29
  image_in = convert_base64_to_img(image_string)
30
+ client = Client("https://fffiloni-moondream1.hf.space/", hf_token=hf_token)
31
  result = client.predict(
32
  image_in, # filepath in 'image' Image component
33
  question, # str in 'Question' Textbox component