Spaces:
Build error
Build error
style: run linter
Browse files- image2text.py +5 -7
image2text.py
CHANGED
|
@@ -1,6 +1,5 @@
|
|
| 1 |
import jax
|
| 2 |
import jax.numpy as jnp
|
| 3 |
-
import numpy as np
|
| 4 |
import pandas as pd
|
| 5 |
import requests
|
| 6 |
import streamlit as st
|
|
@@ -30,9 +29,7 @@ def app(model_name):
|
|
| 30 |
col1, col2 = st.beta_columns([3, 1])
|
| 31 |
|
| 32 |
with col2:
|
| 33 |
-
captions_count = st.selectbox(
|
| 34 |
-
"Number of labels", options=range(1, 6), index=2
|
| 35 |
-
)
|
| 36 |
compute = st.button("Classify")
|
| 37 |
|
| 38 |
with col1:
|
|
@@ -49,10 +46,12 @@ def app(model_name):
|
|
| 49 |
st.markdown("""---""")
|
| 50 |
with st.spinner("Computing..."):
|
| 51 |
image_data = (
|
| 52 |
-
query2
|
|
|
|
|
|
|
| 53 |
)
|
| 54 |
image = Image.open(image_data)
|
| 55 |
-
|
| 56 |
# captions = [caption.strip() for caption in captions.split(",")]
|
| 57 |
captions = [f"์ด๊ฒ์ {caption.strip()}์ด๋ค." for caption in captions]
|
| 58 |
inputs = processor(
|
|
@@ -70,4 +69,3 @@ def app(model_name):
|
|
| 70 |
st.image(image)
|
| 71 |
with col2:
|
| 72 |
st.bar_chart(chart_data)
|
| 73 |
-
|
|
|
|
| 1 |
import jax
|
| 2 |
import jax.numpy as jnp
|
|
|
|
| 3 |
import pandas as pd
|
| 4 |
import requests
|
| 5 |
import streamlit as st
|
|
|
|
| 29 |
col1, col2 = st.beta_columns([3, 1])
|
| 30 |
|
| 31 |
with col2:
|
| 32 |
+
captions_count = st.selectbox("Number of labels", options=range(1, 6), index=2)
|
|
|
|
|
|
|
| 33 |
compute = st.button("Classify")
|
| 34 |
|
| 35 |
with col1:
|
|
|
|
| 46 |
st.markdown("""---""")
|
| 47 |
with st.spinner("Computing..."):
|
| 48 |
image_data = (
|
| 49 |
+
query2
|
| 50 |
+
if query2 is not None
|
| 51 |
+
else requests.get(query1, stream=True).raw
|
| 52 |
)
|
| 53 |
image = Image.open(image_data)
|
| 54 |
+
|
| 55 |
# captions = [caption.strip() for caption in captions.split(",")]
|
| 56 |
captions = [f"์ด๊ฒ์ {caption.strip()}์ด๋ค." for caption in captions]
|
| 57 |
inputs = processor(
|
|
|
|
| 69 |
st.image(image)
|
| 70 |
with col2:
|
| 71 |
st.bar_chart(chart_data)
|
|
|