the-future-dev commited on
Commit
beccfdf
1 Parent(s): 602adb2

first commit

Browse files
Files changed (2) hide show
  1. app.py +1 -1
  2. kosmos.py +3 -3
app.py CHANGED
@@ -15,7 +15,7 @@ if uploaded_file is not None:
15
  if st.button('Classify'):
16
  st.write(f"User: {prompt}")
17
  with st.spinner('Processing...'):
18
- label = kosmos.single_image_classification(image, prompt, 50)
19
  st.write(f"Model: {label}")
20
  except Exception as e:
21
  st.error(f"An error occurred: {e}")
 
15
  if st.button('Classify'):
16
  st.write(f"User: {prompt}")
17
  with st.spinner('Processing...'):
18
+ label = kosmos.single_image_classification(image, prompt, 150)
19
  st.write(f"Model: {label}")
20
  except Exception as e:
21
  st.error(f"An error occurred: {e}")
kosmos.py CHANGED
@@ -19,8 +19,8 @@ def single_image_classification(image, prompt="", max_new_tokens=30):
19
  use_cache=True,
20
  max_new_tokens=max_new_tokens,
21
  )
22
- generated_text = processor.batch_decode(generated_ids, skip_special_tokens=False)[0]
23
 
24
- processed_text = processor.post_process_generation(generated_text, cleanup_and_extract=False)
25
- print("ROBOT:", processed_text)
26
  return processed_text
 
19
  use_cache=True,
20
  max_new_tokens=max_new_tokens,
21
  )
22
+ generated_text = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
23
 
24
+ caption, entities = processor.post_process_generation(generated_text)
25
+ print("ROBOT:", caption)
26
  return processed_text