Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -34,8 +34,8 @@ st.markdown(
|
|
34 |
)
|
35 |
|
36 |
# Streamlit app title and instructions
|
37 |
-
st.title("
|
38 |
-
st.write("Upload an image
|
39 |
|
40 |
# Column layout for input and display
|
41 |
col1, col2 = st.columns([3, 2])
|
@@ -72,12 +72,21 @@ with col2:
|
|
72 |
with torch.no_grad():
|
73 |
outputs = model.generate(**inputs, max_new_tokens=default_max_tokens)
|
74 |
|
75 |
-
# Decode output
|
76 |
decoded_output = processor.decode(outputs[0], skip_special_tokens=True)
|
77 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
# Display result
|
79 |
st.success("Analysis Complete!")
|
80 |
st.write("**Model Output:**", decoded_output)
|
81 |
|
|
|
|
|
82 |
except Exception as e:
|
83 |
st.error(f"Error: {str(e)}")
|
|
|
34 |
)
|
35 |
|
36 |
# Streamlit app title and instructions
|
37 |
+
st.title("VisionDerm")
|
38 |
+
st.write("Upload an image to identify the skin condition.")
|
39 |
|
40 |
# Column layout for input and display
|
41 |
col1, col2 = st.columns([3, 2])
|
|
|
72 |
with torch.no_grad():
|
73 |
outputs = model.generate(**inputs, max_new_tokens=default_max_tokens)
|
74 |
|
75 |
+
# Decode output and remove the prompt text from the response
|
76 |
decoded_output = processor.decode(outputs[0], skip_special_tokens=True)
|
77 |
+
|
78 |
+
# Remove the prompt text from the model output if present
|
79 |
+
if prompt in decoded_output:
|
80 |
+
decoded_output = decoded_output.replace(prompt, "").strip()
|
81 |
+
|
82 |
+
# Capitalize the first letter of each word
|
83 |
+
decoded_output = decoded_output.title()
|
84 |
+
|
85 |
# Display result
|
86 |
st.success("Analysis Complete!")
|
87 |
st.write("**Model Output:**", decoded_output)
|
88 |
|
89 |
+
|
90 |
+
|
91 |
except Exception as e:
|
92 |
st.error(f"Error: {str(e)}")
|