ardavey commited on
Commit
9a5d9ef
1 Parent(s): 87fabef

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -4
app.py CHANGED
@@ -34,8 +34,8 @@ st.markdown(
34
  )
35
 
36
  # Streamlit app title and instructions
37
- st.title("Skin Condition Identifier")
38
- st.write("Upload an image and provide a custom prompt to identify the skin condition.")
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)}")